@@ -22,17 +22,17 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
2222import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
2323import com.fasterxml.jackson.module.kotlin.readValue
2424import software.aws.toolkits.core.utils.createParentDirectories
25- import software.aws.toolkits.core.utils.debug
2625import software.aws.toolkits.core.utils.deleteIfExists
2726import software.aws.toolkits.core.utils.getLogger
27+ import software.aws.toolkits.core.utils.info
2828import software.aws.toolkits.core.utils.inputStreamIfExists
2929import software.aws.toolkits.core.utils.outputStream
3030import software.aws.toolkits.core.utils.toHexString
3131import software.aws.toolkits.core.utils.touch
3232import software.aws.toolkits.core.utils.tryDirOp
3333import software.aws.toolkits.core.utils.tryFileOp
3434import software.aws.toolkits.core.utils.tryOrNull
35- import software.aws.toolkits.core.utils.warn
35+ import software.aws.toolkits.jetbrains.services.telemetry.scrubNames
3636import software.aws.toolkits.telemetry.AuthTelemetry
3737import software.aws.toolkits.telemetry.Result
3838import java.io.InputStream
@@ -97,38 +97,38 @@ class DiskCache(
9797 }
9898
9999 override fun invalidateClientRegistration (ssoRegion : String ) {
100- LOG .debug { " invalidateClientRegistration for $ssoRegion " }
100+ LOG .info { " invalidateClientRegistration for $ssoRegion " }
101101 clientRegistrationCache(ssoRegion).tryDeleteIfExists()
102102 }
103103
104104 override fun loadClientRegistration (cacheKey : ClientRegistrationCacheKey ): ClientRegistration ? {
105- LOG .debug { " loadClientRegistration for $cacheKey " }
105+ LOG .info { " loadClientRegistration for $cacheKey " }
106106 val inputStream = clientRegistrationCache(cacheKey).tryInputStreamIfExists()
107107 if (inputStream == null ) {
108108 val stage = LoadCredentialStage .ACCESS_FILE
109- LOG .warn { " Failed to load Client Registration: cache file does not exist" }
109+ LOG .info { " Failed to load Client Registration: cache file does not exist" }
110110 AuthTelemetry .modifyConnection(
111111 action = " Load cache file" ,
112112 source = " loadClientRegistration" ,
113113 result = Result .Failed ,
114114 reason = " Failed to load Client Registration" ,
115- reasonDesc = " Load Step:$stage failed. Unable to load file "
115+ reasonDesc = " Load Step:$stage failed. Cache file does not exist "
116116 )
117117 return null
118118 }
119119 return loadClientRegistration(inputStream)
120120 }
121121
122122 override fun saveClientRegistration (cacheKey : ClientRegistrationCacheKey , registration : ClientRegistration ) {
123- LOG .debug { " saveClientRegistration for $cacheKey " }
123+ LOG .info { " saveClientRegistration for $cacheKey " }
124124 val registrationCache = clientRegistrationCache(cacheKey)
125125 writeKey(registrationCache) {
126126 objectMapper.writeValue(it, registration)
127127 }
128128 }
129129
130130 override fun invalidateClientRegistration (cacheKey : ClientRegistrationCacheKey ) {
131- LOG .debug { " invalidateClientRegistration for $cacheKey " }
131+ LOG .info { " invalidateClientRegistration for $cacheKey " }
132132 try {
133133 clientRegistrationCache(cacheKey).tryDeleteIfExists()
134134 } catch (e: Exception ) {
@@ -137,14 +137,14 @@ class DiskCache(
137137 source = " invalidateClientRegistration" ,
138138 result = Result .Failed ,
139139 reason = " Failed to invalidate Client Registration" ,
140- reasonDesc = e.message ? : e::class .java.name
140+ reasonDesc = e.message?. let { scrubNames(it) } ? : e::class .java.name
141141 )
142142 throw e
143143 }
144144 }
145145
146146 override fun invalidateAccessToken (ssoUrl : String ) {
147- LOG .debug { " invalidateAccessToken for $ssoUrl " }
147+ LOG .info { " invalidateAccessToken for $ssoUrl " }
148148 try {
149149 accessTokenCache(ssoUrl).tryDeleteIfExists()
150150 } catch (e: Exception ) {
@@ -153,14 +153,14 @@ class DiskCache(
153153 source = " invalidateAccessToken" ,
154154 result = Result .Failed ,
155155 reason = " Failed to invalidate Access Token" ,
156- reasonDesc = e.message ? : e::class .java.name
156+ reasonDesc = e.message?. let { scrubNames(it) } ? : e::class .java.name
157157 )
158158 throw e
159159 }
160160 }
161161
162162 override fun loadAccessToken (cacheKey : AccessTokenCacheKey ): AccessToken ? {
163- LOG .debug { " loadAccessToken for $cacheKey " }
163+ LOG .info { " loadAccessToken for $cacheKey " }
164164 val cacheFile = accessTokenCache(cacheKey)
165165 val inputStream = cacheFile.tryInputStreamIfExists() ? : return null
166166
@@ -170,15 +170,15 @@ class DiskCache(
170170 }
171171
172172 override fun saveAccessToken (cacheKey : AccessTokenCacheKey , accessToken : AccessToken ) {
173- LOG .debug { " saveAccessToken for $cacheKey " }
173+ LOG .info { " saveAccessToken for $cacheKey " }
174174 val accessTokenCache = accessTokenCache(cacheKey)
175175 writeKey(accessTokenCache) {
176176 objectMapper.writeValue(it, accessToken)
177177 }
178178 }
179179
180180 override fun invalidateAccessToken (cacheKey : AccessTokenCacheKey ) {
181- LOG .debug { " invalidateAccessToken for $cacheKey " }
181+ LOG .info { " invalidateAccessToken for $cacheKey " }
182182 try {
183183 accessTokenCache(cacheKey).tryDeleteIfExists()
184184 } catch (e: Exception ) {
@@ -187,7 +187,7 @@ class DiskCache(
187187 source = " invalidateAccessToken" ,
188188 result = Result .Failed ,
189189 reason = " Failed to invalidate Access Token" ,
190- reasonDesc = e.message ? : e::class .java.name
190+ reasonDesc = e.message?. let { scrubNames(it) } ? : e::class .java.name
191191 )
192192 throw e
193193 }
@@ -203,7 +203,7 @@ class DiskCache(
203203 val sha = sha1(cacheNameMapper.writeValueAsString(it))
204204
205205 cacheDir.resolve(" $sha .json" ).also {
206- LOG .debug { " $cacheKey resolves to $it " }
206+ LOG .info { " $cacheKey resolves to $it " }
207207 }
208208 }
209209
@@ -225,7 +225,7 @@ class DiskCache(
225225 if (clientRegistration.expiresAt.isNotExpired()) {
226226 return clientRegistration
227227 } else {
228- LOG .warn { " Client Registration is expired" }
228+ LOG .info { " Client Registration is expired" }
229229 AuthTelemetry .modifyConnection(
230230 action = " Validate Credentials" ,
231231 source = " loadClientRegistration" ,
@@ -236,7 +236,7 @@ class DiskCache(
236236 return null
237237 }
238238 } catch (e: Exception ) {
239- LOG .warn { " Client Registration could not be read" }
239+ LOG .info { " Client Registration could not be read" }
240240 AuthTelemetry .modifyConnection(
241241 action = " Validate Credentials" ,
242242 source = " loadClientRegistration" ,
@@ -269,7 +269,7 @@ class DiskCache(
269269 }
270270
271271 private fun writeKey (path : Path , consumer : (OutputStream ) -> Unit ) {
272- LOG .debug { " writing to $path " }
272+ LOG .info { " writing to $path " }
273273 try {
274274 path.tryDirOp(LOG ) { createParentDirectories() }
275275
@@ -283,7 +283,7 @@ class DiskCache(
283283 source = " writeKey" ,
284284 result = Result .Failed ,
285285 reason = " Failed to write to cache" ,
286- reasonDesc = e.message ? : e::class .java.name
286+ reasonDesc = e.message?. let { scrubNames(it) } ? : e::class .java.name
287287 )
288288 throw e
289289 }
0 commit comments