@@ -9,8 +9,8 @@ import type { TrackingContext } from '../../constants.telemetry';
99import type { Container , Environment } from '../../container' ;
1010import { CancellationError } from '../../errors' ;
1111import { debug } from '../../system/decorators/log' ;
12- import { Logger } from '../../system/logger' ;
13- import { getLogScope , setLogScopeExit } from '../../system/logger.scope' ;
12+ import { getLoggableName , Logger } from '../../system/logger' ;
13+ import { getLogScope , setLogScopeExit , startLogScope } from '../../system/logger.scope' ;
1414import { AuthenticationConnection } from './authenticationConnection' ;
1515import type { ServerConnection } from './serverConnection' ;
1616
@@ -203,6 +203,8 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
203203 }
204204
205205 private async checkForUpdates ( ) {
206+ using scope = startLogScope ( `${ getLoggableName ( this ) } .checkForUpdates` , false ) ;
207+
206208 const previousSessions = await this . _sessionsPromise ;
207209 this . _sessionsPromise = this . getSessionsFromStorage ( ) ;
208210 const storedSessions = await this . _sessionsPromise ;
@@ -225,7 +227,7 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
225227 }
226228
227229 if ( added . length || removed . length ) {
228- Logger . debug ( `Firing sessions changed event; added=${ added . length } , removed=${ removed . length } `) ;
230+ Logger . debug ( scope , `firing sessions changed event; added=${ added . length } , removed=${ removed . length } `) ;
229231 this . _onDidChangeSessions . fire ( { added : added , removed : removed , changed : [ ] } ) ;
230232 }
231233 }
@@ -255,6 +257,8 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
255257 }
256258
257259 private async getSessionsFromStorage ( ) : Promise < AuthenticationSession [ ] > {
260+ using scope = startLogScope ( `${ getLoggableName ( this ) } .getSessionsFromStorage` , false ) ;
261+
258262 let storedSessions : StoredSession [ ] ;
259263
260264 try {
@@ -271,20 +275,20 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
271275 throw ex ;
272276 }
273277 } catch ( ex ) {
274- Logger . error ( ex , 'Unable to read sessions from storage' ) ;
278+ Logger . error ( ex , scope , 'Unable to read sessions from storage' ) ;
275279 return [ ] ;
276280 }
277281
278282 const sessionPromises = storedSessions . map ( async ( session : StoredSession ) => {
279283 const scopesKey = getScopesKey ( session . scopes ) ;
280284
281- Logger . debug ( `Read session from storage with scopes=${ scopesKey } `) ;
285+ Logger . debug ( scope , `read session from storage with scopes=${ scopesKey } `) ;
282286
283287 let userInfo : { id : string ; accountName : string } | undefined ;
284288 if ( session . account == null ) {
285289 try {
286290 userInfo = await this . _authConnection . getAccountInfo ( session . accessToken ) ;
287- Logger . debug ( `Verified session with scopes=${ scopesKey } `) ;
291+ Logger . debug ( scope , `verified session with scopes=${ scopesKey } `) ;
288292 } catch ( ex ) {
289293 // Remove sessions that return unauthorized response
290294 if ( ex . message === 'Unauthorized' ) return undefined ;
@@ -310,7 +314,7 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
310314 . map ( p => ( p as PromiseFulfilledResult < AuthenticationSession | undefined > ) . value )
311315 . filter ( < T > ( p ?: T ) : p is T => Boolean ( p ) ) ;
312316
313- Logger . debug ( `Found ${ verifiedSessions . length } verified sessions`) ;
317+ Logger . debug ( scope , `found ${ verifiedSessions . length } verified sessions`) ;
314318 if ( verifiedSessions . length !== storedSessions . length ) {
315319 await this . storeSessions ( verifiedSessions ) ;
316320 }
0 commit comments