Skip to content

Commit 0a3faba

Browse files
committed
Refactor: use jetbrains logger
1 parent fca838d commit 0a3faba

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

src/main/kotlin/com/coder/gateway/CoderGatewayConnectionProvider.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.coder.gateway.models.RecentWorkspaceConnection
44
import com.coder.gateway.services.CoderRecentWorkspaceConnectionsService
55
import com.coder.gateway.views.CoderGatewayConnectionComponent
66
import com.intellij.openapi.components.service
7+
import com.intellij.openapi.diagnostic.Logger
78
import com.intellij.openapi.rd.util.launchUnderBackgroundProgress
89
import com.intellij.remote.AuthType
910
import com.intellij.remote.RemoteCredentialsHolder
@@ -22,7 +23,6 @@ import kotlinx.coroutines.launch
2223
import java.time.Duration
2324
import java.time.LocalDateTime
2425
import java.time.format.DateTimeFormatter
25-
import java.util.logging.Logger
2626
import javax.swing.JComponent
2727

2828
class CoderGatewayConnectionProvider : GatewayConnectionProvider {
@@ -40,7 +40,7 @@ class CoderGatewayConnectionProvider : GatewayConnectionProvider {
4040
if (coderWorkspaceHostname != null && projectPath != null) {
4141
val connection = CoderConnectionMetadata(coderWorkspaceHostname)
4242
if (connection in connections) {
43-
logger.warning("There is already a connection started on ${connection.workspaceHostname}")
43+
logger.warn("There is already a connection started on ${connection.workspaceHostname}")
4444
return null
4545
}
4646
val clientLifetime = LifetimeDefinition()
@@ -114,7 +114,7 @@ class CoderGatewayConnectionProvider : GatewayConnectionProvider {
114114
}
115115

116116
companion object {
117-
val logger = Logger.getLogger(CoderGatewayConnectionProvider::class.java.simpleName)
117+
val logger = Logger.getInstance(CoderGatewayConnectionProvider::class.java.simpleName)
118118
}
119119
}
120120

src/main/kotlin/com/coder/gateway/sdk/CoderCLIDownloader.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.coder.gateway.sdk
22

3+
import com.intellij.openapi.diagnostic.Logger
34
import java.io.InputStream
45
import java.net.URL
56
import java.nio.file.Files
67
import java.nio.file.Path
78
import java.nio.file.StandardCopyOption
8-
import java.util.logging.Logger
99

1010
class CoderCLIDownloader {
1111

@@ -19,6 +19,6 @@ class CoderCLIDownloader {
1919
}
2020

2121
companion object {
22-
val logger = Logger.getLogger(CoderCLIDownloader::class.java.simpleName)
22+
val logger = Logger.getInstance(CoderCLIDownloader::class.java.simpleName)
2323
}
2424
}

src/main/kotlin/com/coder/gateway/sdk/CoderCLIManager.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.coder.gateway.sdk
22

3+
import com.intellij.openapi.diagnostic.Logger
34
import java.net.URL
45
import java.nio.file.Path
5-
import java.util.logging.Logger
66

77
class CoderCLIManager(private val url: URL) {
88
private val coderCLIDownloader = CoderCLIDownloader()
@@ -41,6 +41,6 @@ class CoderCLIManager(private val url: URL) {
4141
}
4242

4343
companion object {
44-
val logger = Logger.getLogger(CoderCLIManager::class.java.simpleName)
44+
val logger = Logger.getInstance(CoderCLIManager::class.java.simpleName)
4545
}
4646
}

src/main/kotlin/com/coder/gateway/views/steps/CoderAuthStepView.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.intellij.openapi.Disposable
1515
import com.intellij.openapi.application.ApplicationManager
1616
import com.intellij.openapi.application.ModalityState
1717
import com.intellij.openapi.application.invokeAndWaitIfNeeded
18+
import com.intellij.openapi.diagnostic.Logger
1819
import com.intellij.openapi.progress.ProgressIndicator
1920
import com.intellij.openapi.progress.ProgressManager
2021
import com.intellij.openapi.progress.Task
@@ -35,7 +36,6 @@ import kotlinx.coroutines.Dispatchers
3536
import kotlinx.coroutines.cancel
3637
import org.zeroturnaround.exec.ProcessExecutor
3738
import java.awt.Dimension
38-
import java.util.logging.Logger
3939

4040
class CoderAuthStepView : CoderWorkspacesWizardStep, Disposable {
4141
private val cs = CoroutineScope(Dispatchers.Main)
@@ -147,6 +147,6 @@ class CoderAuthStepView : CoderWorkspacesWizardStep, Disposable {
147147
}
148148

149149
companion object {
150-
val logger = Logger.getLogger(CoderAuthStepView::class.java.simpleName)
150+
val logger = Logger.getInstance(CoderAuthStepView::class.java.simpleName)
151151
}
152152
}

src/main/kotlin/com/coder/gateway/views/steps/CoderLocateRemoteProjectStepView.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.coder.gateway.views.LazyBrowserLink
88
import com.intellij.ide.IdeBundle
99
import com.intellij.openapi.Disposable
1010
import com.intellij.openapi.application.ApplicationManager
11+
import com.intellij.openapi.diagnostic.Logger
1112
import com.intellij.openapi.ui.ComboBox
1213
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
1314
import com.intellij.remote.AuthType
@@ -34,7 +35,6 @@ import kotlinx.coroutines.launch
3435
import kotlinx.coroutines.withContext
3536
import java.awt.Component
3637
import java.awt.FlowLayout
37-
import java.util.logging.Logger
3838
import javax.swing.ComboBoxModel
3939
import javax.swing.DefaultComboBoxModel
4040
import javax.swing.JLabel
@@ -102,7 +102,7 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
102102
wizard = wizardModel
103103
val selectedWorkspace = wizardModel.selectedWorkspace
104104
if (selectedWorkspace == null) {
105-
logger.warning("No workspace was selected. Please go back to the previous step and select a Coder Workspace")
105+
logger.warn("No workspace was selected. Please go back to the previous step and select a Coder Workspace")
106106
return
107107
}
108108

@@ -125,7 +125,7 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
125125
.map { ide -> IdeWithStatus(ide.product, ide.buildNumber, IdeStatus.DOWNLOAD, ide.downloadLink, ide.presentableVersion) }
126126

127127
if (idesWithStatus.isNullOrEmpty()) {
128-
logger.warning("Could not resolve any IDE for workspace ${selectedWorkspace.name}, probably $workspaceOS is not supported by Gateway")
128+
logger.warn("Could not resolve any IDE for workspace ${selectedWorkspace.name}, probably $workspaceOS is not supported by Gateway")
129129
} else {
130130
cbIDE.remove(spinner)
131131
ideComboBoxModel.addAll(idesWithStatus)
@@ -157,7 +157,7 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
157157
}
158158

159159
companion object {
160-
val logger = Logger.getLogger(CoderLocateRemoteProjectStepView::class.java.simpleName)
160+
val logger = Logger.getInstance(CoderLocateRemoteProjectStepView::class.java.simpleName)
161161
}
162162

163163
private class IDEComboBox(model: ComboBoxModel<IdeWithStatus>) : ComboBox<IdeWithStatus>(model) {

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import kotlinx.coroutines.CoroutineScope
2121
import kotlinx.coroutines.Dispatchers
2222
import kotlinx.coroutines.launch
2323
import kotlinx.coroutines.withContext
24-
import java.util.logging.Logger
2524

2625
class CoderWorkspacesStepView : CoderWorkspacesWizardStep, Disposable {
2726
private val cs = CoroutineScope(Dispatchers.Main)
@@ -78,8 +77,4 @@ class CoderWorkspacesStepView : CoderWorkspacesWizardStep, Disposable {
7877
override fun dispose() {
7978

8079
}
81-
82-
companion object {
83-
val logger = Logger.getLogger(CoderWorkspacesStepView::class.java.simpleName)
84-
}
8580
}

0 commit comments

Comments
 (0)