Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 836a74b

Browse files
committed
impl: improve logging during connection setup
1 parent 03e2cc3 commit 836a74b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,15 @@ class CoderRemoteProvider(
398398
context.secrets.lastDeploymentURL = client.url.toString()
399399
context.secrets.lastToken = client.token ?: ""
400400
context.secrets.storeTokenFor(client.url, context.secrets.lastToken)
401+
context.logger.info("Deployment URL and token were stored and will be available for automatic connection")
401402
this.client = client
402403
pollJob?.cancel()
404+
context.logger.info("Previous poll job was canceled")
403405
environments.showLoadingMessage()
404406
coderHeaderPage.setTitle(context.i18n.pnotr(client.url.toString()))
407+
context.logger.info("Displaying ${client.url} in the UI")
405408
pollJob = poll(client, cli)
409+
context.logger.info("Workspace poller job created with reference $pollJob")
406410
context.envPageManager.showPluginEnvironmentsPage()
407411
}
408412

src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class ConnectStep(
7676
signInJob?.cancel()
7777
signInJob = context.cs.launch(CoroutineName("Http and CLI Setup")) {
7878
try {
79+
context.logger.info("Setting up the HTTP client...")
7980
val client = CoderRestClient(
8081
context,
8182
CoderCliSetupContext.url!!,
@@ -104,6 +105,7 @@ class ConnectStep(
104105
yield()
105106
CoderCliSetupContext.reset()
106107
CoderCliSetupWizardState.goToFirstStep()
108+
context.logger.info("Connection setup done, initializing the workspace poller...")
107109
onConnect(client, cli)
108110
} catch (ex: CancellationException) {
109111
if (ex.message != USER_HIT_THE_BACK_BUTTON) {
@@ -130,6 +132,7 @@ class ConnectStep(
130132

131133
override fun onBack() {
132134
try {
135+
context.logger.info("Back button was pressed, cancelling in-progress connection setup...")
133136
signInJob?.cancel(CancellationException(USER_HIT_THE_BACK_BUTTON))
134137
} finally {
135138
if (shouldAutoLogin.value) {

0 commit comments

Comments
 (0)