Skip to content

Commit c65f2b8

Browse files
Change debug/warn logs to info (#5058)
* change log to info * lazyLog
1 parent 82f2275 commit c65f2b8

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/DiskCache.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
2222
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
2323
import com.fasterxml.jackson.module.kotlin.readValue
2424
import software.aws.toolkits.core.utils.createParentDirectories
25-
import software.aws.toolkits.core.utils.debug
2625
import software.aws.toolkits.core.utils.deleteIfExists
2726
import software.aws.toolkits.core.utils.getLogger
27+
import software.aws.toolkits.core.utils.info
2828
import software.aws.toolkits.core.utils.inputStreamIfExists
2929
import software.aws.toolkits.core.utils.outputStream
3030
import software.aws.toolkits.core.utils.toHexString
3131
import software.aws.toolkits.core.utils.touch
3232
import software.aws.toolkits.core.utils.tryDirOp
3333
import software.aws.toolkits.core.utils.tryFileOp
3434
import software.aws.toolkits.core.utils.tryOrNull
35-
import software.aws.toolkits.core.utils.warn
3635
import software.aws.toolkits.telemetry.AuthTelemetry
3736
import software.aws.toolkits.telemetry.Result
3837
import java.io.InputStream
@@ -97,16 +96,16 @@ class DiskCache(
9796
}
9897

9998
override fun invalidateClientRegistration(ssoRegion: String) {
100-
LOG.debug { "invalidateClientRegistration for $ssoRegion" }
99+
LOG.info { "invalidateClientRegistration for $ssoRegion" }
101100
clientRegistrationCache(ssoRegion).tryDeleteIfExists()
102101
}
103102

104103
override fun loadClientRegistration(cacheKey: ClientRegistrationCacheKey): ClientRegistration? {
105-
LOG.debug { "loadClientRegistration for $cacheKey" }
104+
LOG.info { "loadClientRegistration for $cacheKey" }
106105
val inputStream = clientRegistrationCache(cacheKey).tryInputStreamIfExists()
107106
if (inputStream == null) {
108107
val stage = LoadCredentialStage.ACCESS_FILE
109-
LOG.warn { "Failed to load Client Registration: cache file does not exist" }
108+
LOG.info { "Failed to load Client Registration: cache file does not exist" }
110109
AuthTelemetry.modifyConnection(
111110
action = "Load cache file",
112111
source = "loadClientRegistration",
@@ -120,15 +119,15 @@ class DiskCache(
120119
}
121120

122121
override fun saveClientRegistration(cacheKey: ClientRegistrationCacheKey, registration: ClientRegistration) {
123-
LOG.debug { "saveClientRegistration for $cacheKey" }
122+
LOG.info { "saveClientRegistration for $cacheKey" }
124123
val registrationCache = clientRegistrationCache(cacheKey)
125124
writeKey(registrationCache) {
126125
objectMapper.writeValue(it, registration)
127126
}
128127
}
129128

130129
override fun invalidateClientRegistration(cacheKey: ClientRegistrationCacheKey) {
131-
LOG.debug { "invalidateClientRegistration for $cacheKey" }
130+
LOG.info { "invalidateClientRegistration for $cacheKey" }
132131
try {
133132
clientRegistrationCache(cacheKey).tryDeleteIfExists()
134133
} catch (e: Exception) {
@@ -144,7 +143,7 @@ class DiskCache(
144143
}
145144

146145
override fun invalidateAccessToken(ssoUrl: String) {
147-
LOG.debug { "invalidateAccessToken for $ssoUrl" }
146+
LOG.info { "invalidateAccessToken for $ssoUrl" }
148147
try {
149148
accessTokenCache(ssoUrl).tryDeleteIfExists()
150149
} catch (e: Exception) {
@@ -160,7 +159,7 @@ class DiskCache(
160159
}
161160

162161
override fun loadAccessToken(cacheKey: AccessTokenCacheKey): AccessToken? {
163-
LOG.debug { "loadAccessToken for $cacheKey" }
162+
LOG.info { "loadAccessToken for $cacheKey" }
164163
val cacheFile = accessTokenCache(cacheKey)
165164
val inputStream = cacheFile.tryInputStreamIfExists() ?: return null
166165

@@ -170,15 +169,15 @@ class DiskCache(
170169
}
171170

172171
override fun saveAccessToken(cacheKey: AccessTokenCacheKey, accessToken: AccessToken) {
173-
LOG.debug { "saveAccessToken for $cacheKey" }
172+
LOG.info { "saveAccessToken for $cacheKey" }
174173
val accessTokenCache = accessTokenCache(cacheKey)
175174
writeKey(accessTokenCache) {
176175
objectMapper.writeValue(it, accessToken)
177176
}
178177
}
179178

180179
override fun invalidateAccessToken(cacheKey: AccessTokenCacheKey) {
181-
LOG.debug { "invalidateAccessToken for $cacheKey" }
180+
LOG.info { "invalidateAccessToken for $cacheKey" }
182181
try {
183182
accessTokenCache(cacheKey).tryDeleteIfExists()
184183
} catch (e: Exception) {
@@ -203,7 +202,7 @@ class DiskCache(
203202
val sha = sha1(cacheNameMapper.writeValueAsString(it))
204203

205204
cacheDir.resolve("$sha.json").also {
206-
LOG.debug { "$cacheKey resolves to $it" }
205+
LOG.info { "$cacheKey resolves to $it" }
207206
}
208207
}
209208

@@ -225,7 +224,7 @@ class DiskCache(
225224
if (clientRegistration.expiresAt.isNotExpired()) {
226225
return clientRegistration
227226
} else {
228-
LOG.warn { "Client Registration is expired" }
227+
LOG.info { "Client Registration is expired" }
229228
AuthTelemetry.modifyConnection(
230229
action = "Validate Credentials",
231230
source = "loadClientRegistration",
@@ -236,7 +235,7 @@ class DiskCache(
236235
return null
237236
}
238237
} catch (e: Exception) {
239-
LOG.warn { "Client Registration could not be read" }
238+
LOG.info { "Client Registration could not be read" }
240239
AuthTelemetry.modifyConnection(
241240
action = "Validate Credentials",
242241
source = "loadClientRegistration",
@@ -269,7 +268,7 @@ class DiskCache(
269268
}
270269

271270
private fun writeKey(path: Path, consumer: (OutputStream) -> Unit) {
272-
LOG.debug { "writing to $path" }
271+
LOG.info { "writing to $path" }
273272
try {
274273
path.tryDirOp(LOG) { createParentDirectories() }
275274

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import software.amazon.awssdk.services.ssooidc.model.InvalidClientException
1818
import software.amazon.awssdk.services.ssooidc.model.InvalidRequestException
1919
import software.amazon.awssdk.services.ssooidc.model.SlowDownException
2020
import software.aws.toolkits.core.utils.getLogger
21+
import software.aws.toolkits.core.utils.info
2122
import software.aws.toolkits.core.utils.warn
2223
import software.aws.toolkits.jetbrains.core.credentials.sono.SONO_URL
2324
import software.aws.toolkits.jetbrains.core.credentials.sso.pkce.PKCE_CLIENT_NAME
@@ -498,7 +499,7 @@ class SsoAccessTokenProvider(
498499
requestId = requestId,
499500
result = Result.Failed
500501
)
501-
LOG.warn { "RefreshAccessTokenFailed: ${e.message}" }
502+
LOG.info { "RefreshAccessTokenFailed: ${e.message}" }
502503
throw e
503504
}
504505
}

0 commit comments

Comments
 (0)