diff --git a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/DiskCache.kt b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/DiskCache.kt index 970f6e87686..824ba60d20e 100644 --- a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/DiskCache.kt +++ b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/DiskCache.kt @@ -32,6 +32,7 @@ import software.aws.toolkits.core.utils.touch import software.aws.toolkits.core.utils.tryDirOp import software.aws.toolkits.core.utils.tryFileOp import software.aws.toolkits.core.utils.tryOrNull +import software.aws.toolkits.core.utils.warn import software.aws.toolkits.telemetry.AuthTelemetry import software.aws.toolkits.telemetry.Result import java.io.InputStream @@ -105,7 +106,7 @@ class DiskCache( val inputStream = clientRegistrationCache(cacheKey).tryInputStreamIfExists() if (inputStream == null) { val stage = LoadCredentialStage.ACCESS_FILE - LOG.warn("Failed to load Client Registration: cache file does not exist") + LOG.warn { "Failed to load Client Registration: cache file does not exist" } AuthTelemetry.modifyConnection( action = "Load cache file", source = "loadClientRegistration", @@ -224,7 +225,7 @@ class DiskCache( if (clientRegistration.expiresAt.isNotExpired()) { return clientRegistration } else { - LOG.warn("Client Registration is expired") + LOG.warn { "Client Registration is expired" } AuthTelemetry.modifyConnection( action = "Validate Credentials", source = "loadClientRegistration", @@ -235,7 +236,7 @@ class DiskCache( return null } } catch (e: Exception) { - LOG.warn("Client Registration could not be read") + LOG.warn { "Client Registration could not be read" } AuthTelemetry.modifyConnection( action = "Validate Credentials", source = "loadClientRegistration", diff --git a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt index a83749bdaa4..6ae8a6ea7e1 100644 --- a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt +++ b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProvider.kt @@ -176,7 +176,7 @@ class SsoAccessTokenProvider( result = Result.Succeeded ) } catch (e: Exception) { - getLogger().warn("Failed to save access token ${e.message}") + LOG.warn { "Failed to save access token ${e.message}" } AuthTelemetry.modifyConnection( action = "Write file", source = "accessToken", @@ -218,7 +218,7 @@ class SsoAccessTokenProvider( result = Result.Succeeded ) } catch (e: Exception) { - getLogger().warn("Failed to save client registration ${e.message}") + LOG.warn { "Failed to save client registration ${e.message}" } AuthTelemetry.modifyConnection( action = "Write file", source = "registerDAGClient", @@ -238,7 +238,7 @@ class SsoAccessTokenProvider( } if (!ssoUrl.contains("identitycenter")) { - getLogger().warn { "$ssoUrl does not appear to be a valid issuer URL" } + LOG.warn { "$ssoUrl does not appear to be a valid issuer URL" } } val registerResponse = client.registerClient { @@ -270,7 +270,7 @@ class SsoAccessTokenProvider( result = Result.Succeeded ) } catch (e: Exception) { - getLogger().warn("Failed to save client registration${e.message}") + LOG.warn { "Failed to save client registration${e.message}" } AuthTelemetry.modifyConnection( action = "Write file", source = "registerPkceClient", @@ -498,7 +498,7 @@ class SsoAccessTokenProvider( requestId = requestId, result = Result.Failed ) - getLogger().warn("RefreshAccessTokenFailed: ${e.message}") + LOG.warn { "RefreshAccessTokenFailed: ${e.message}" } throw e } } @@ -577,5 +577,6 @@ class SsoAccessTokenProvider( // Default number of seconds to poll for token, https://tools.ietf.org/html/draft-ietf-oauth-device-flow-15#section-3.5 const val DEFAULT_INTERVAL_SECS = 5L const val SLOW_DOWN_DELAY_SECS = 5L + private val LOG = getLogger() } }