@@ -24,6 +24,7 @@ import com.fasterxml.jackson.module.kotlin.readValue
2424import software.aws.toolkits.core.utils.createParentDirectories
2525import software.aws.toolkits.core.utils.deleteIfExists
2626import software.aws.toolkits.core.utils.getLogger
27+ import software.aws.toolkits.core.utils.info
2728import software.aws.toolkits.core.utils.inputStreamIfExists
2829import software.aws.toolkits.core.utils.outputStream
2930import software.aws.toolkits.core.utils.toHexString
@@ -95,16 +96,16 @@ class DiskCache(
9596 }
9697
9798 override fun invalidateClientRegistration (ssoRegion : String ) {
98- LOG .info( " invalidateClientRegistration for $ssoRegion " )
99+ LOG .info { " invalidateClientRegistration for $ssoRegion " }
99100 clientRegistrationCache(ssoRegion).tryDeleteIfExists()
100101 }
101102
102103 override fun loadClientRegistration (cacheKey : ClientRegistrationCacheKey ): ClientRegistration ? {
103- LOG .info( " loadClientRegistration for $cacheKey " )
104+ LOG .info { " loadClientRegistration for $cacheKey " }
104105 val inputStream = clientRegistrationCache(cacheKey).tryInputStreamIfExists()
105106 if (inputStream == null ) {
106107 val stage = LoadCredentialStage .ACCESS_FILE
107- LOG .info( " Failed to load Client Registration: cache file does not exist" )
108+ LOG .info { " Failed to load Client Registration: cache file does not exist" }
108109 AuthTelemetry .modifyConnection(
109110 action = " Load cache file" ,
110111 source = " loadClientRegistration" ,
@@ -118,15 +119,15 @@ class DiskCache(
118119 }
119120
120121 override fun saveClientRegistration (cacheKey : ClientRegistrationCacheKey , registration : ClientRegistration ) {
121- LOG .info( " saveClientRegistration for $cacheKey " )
122+ LOG .info { " saveClientRegistration for $cacheKey " }
122123 val registrationCache = clientRegistrationCache(cacheKey)
123124 writeKey(registrationCache) {
124125 objectMapper.writeValue(it, registration)
125126 }
126127 }
127128
128129 override fun invalidateClientRegistration (cacheKey : ClientRegistrationCacheKey ) {
129- LOG .info( " invalidateClientRegistration for $cacheKey " )
130+ LOG .info { " invalidateClientRegistration for $cacheKey " }
130131 try {
131132 clientRegistrationCache(cacheKey).tryDeleteIfExists()
132133 } catch (e: Exception ) {
@@ -142,7 +143,7 @@ class DiskCache(
142143 }
143144
144145 override fun invalidateAccessToken (ssoUrl : String ) {
145- LOG .info( " invalidateAccessToken for $ssoUrl " )
146+ LOG .info { " invalidateAccessToken for $ssoUrl " }
146147 try {
147148 accessTokenCache(ssoUrl).tryDeleteIfExists()
148149 } catch (e: Exception ) {
@@ -158,7 +159,7 @@ class DiskCache(
158159 }
159160
160161 override fun loadAccessToken (cacheKey : AccessTokenCacheKey ): AccessToken ? {
161- LOG .info( " loadAccessToken for $cacheKey " )
162+ LOG .info { " loadAccessToken for $cacheKey " }
162163 val cacheFile = accessTokenCache(cacheKey)
163164 val inputStream = cacheFile.tryInputStreamIfExists() ? : return null
164165
@@ -168,15 +169,15 @@ class DiskCache(
168169 }
169170
170171 override fun saveAccessToken (cacheKey : AccessTokenCacheKey , accessToken : AccessToken ) {
171- LOG .info( " saveAccessToken for $cacheKey " )
172+ LOG .info { " saveAccessToken for $cacheKey " }
172173 val accessTokenCache = accessTokenCache(cacheKey)
173174 writeKey(accessTokenCache) {
174175 objectMapper.writeValue(it, accessToken)
175176 }
176177 }
177178
178179 override fun invalidateAccessToken (cacheKey : AccessTokenCacheKey ) {
179- LOG .info( " invalidateAccessToken for $cacheKey " )
180+ LOG .info { " invalidateAccessToken for $cacheKey " }
180181 try {
181182 accessTokenCache(cacheKey).tryDeleteIfExists()
182183 } catch (e: Exception ) {
@@ -201,7 +202,7 @@ class DiskCache(
201202 val sha = sha1(cacheNameMapper.writeValueAsString(it))
202203
203204 cacheDir.resolve(" $sha .json" ).also {
204- LOG .info( " $cacheKey resolves to $it " )
205+ LOG .info { " $cacheKey resolves to $it " }
205206 }
206207 }
207208
@@ -223,7 +224,7 @@ class DiskCache(
223224 if (clientRegistration.expiresAt.isNotExpired()) {
224225 return clientRegistration
225226 } else {
226- LOG .info( " Client Registration is expired" )
227+ LOG .info { " Client Registration is expired" }
227228 AuthTelemetry .modifyConnection(
228229 action = " Validate Credentials" ,
229230 source = " loadClientRegistration" ,
@@ -234,7 +235,7 @@ class DiskCache(
234235 return null
235236 }
236237 } catch (e: Exception ) {
237- LOG .info( " Client Registration could not be read" )
238+ LOG .info { " Client Registration could not be read" }
238239 AuthTelemetry .modifyConnection(
239240 action = " Validate Credentials" ,
240241 source = " loadClientRegistration" ,
@@ -267,7 +268,7 @@ class DiskCache(
267268 }
268269
269270 private fun writeKey (path : Path , consumer : (OutputStream ) -> Unit ) {
270- LOG .info( " writing to $path " )
271+ LOG .info { " writing to $path " }
271272 try {
272273 path.tryDirOp(LOG ) { createParentDirectories() }
273274
0 commit comments