@@ -65,6 +65,8 @@ export interface IAuthProvider {
6565 */
6666export class AuthUtil implements IAuthProvider {
6767 public readonly profileName = VSCODE_EXTENSION_ID . amazonq
68+ protected logger = getLogger ( 'amazonqAuth' )
69+
6870 public readonly regionProfileManager : RegionProfileManager
6971
7072 // IAM login currently not supported
@@ -278,7 +280,7 @@ export class AuthUtil implements IAuthProvider {
278280 }
279281
280282 private async cacheChangedHandler ( event : cacheChangedEvent ) {
281- getLogger ( ) . debug ( `Auth: Cache change event received: ${ event } ` )
283+ this . logger . debug ( `Cache change event received: ${ event } ` )
282284 if ( event === 'delete' ) {
283285 await this . logout ( )
284286 } else if ( event === 'create' ) {
@@ -292,7 +294,7 @@ export class AuthUtil implements IAuthProvider {
292294 await this . lspAuth . updateBearerToken ( params ! )
293295 return
294296 } else {
295- getLogger ( ) . info ( `codewhisperer: connection changed to ${ e . state } ` )
297+ this . logger . info ( `codewhisperer: connection changed to ${ e . state } ` )
296298 await this . refreshState ( e . state )
297299 }
298300 }
@@ -416,15 +418,15 @@ export class AuthUtil implements IAuthProvider {
416418 new CancellationTokenSource ( ) . token
417419 )
418420 if ( token ) {
419- getLogger ( ) . info ( `codewhisperer: existing LSP auth connection found. Skipping migration` )
421+ this . logger . info ( ' existing LSP auth connection found. Skipping migration' )
420422 await memento . update ( key , undefined )
421423 return
422424 }
423425 } catch {
424- getLogger ( ) . info ( `codewhisperer: unable to get token from LSP auth, proceeding migration` )
426+ this . logger . info ( ' unable to get token from LSP auth, proceeding migration' )
425427 }
426428
427- getLogger ( ) . info ( `codewhisperer: checking for old SSO connections` )
429+ this . logger . info ( ' checking for old SSO connections' )
428430 for ( const [ id , p ] of Object . entries ( profiles ) ) {
429431 if ( p . type === 'sso' && hasExactScopes ( p . scopes ?? [ ] , amazonQScopes ) ) {
430432 toImport = p
@@ -436,7 +438,7 @@ export class AuthUtil implements IAuthProvider {
436438 }
437439
438440 if ( toImport && profileId ) {
439- getLogger ( ) . info ( `codewhisperer: migrating SSO connection to LSP identity server...` )
441+ this . logger . info ( ' migrating SSO connection to LSP identity server...' )
440442
441443 const registrationKey = {
442444 startUrl : toImport . startUrl ,
@@ -466,13 +468,13 @@ export class AuthUtil implements IAuthProvider {
466468 try {
467469 await fs . rename ( fromRegistrationFile , toRegistrationFile )
468470 await fs . rename ( fromTokenFile , toTokenFile )
469- getLogger ( ) . debug ( 'Successfully renamed registration and token files' )
471+ this . logger . debug ( 'Successfully renamed registration and token files' )
470472 } catch ( err ) {
471- getLogger ( ) . error ( `Failed to rename files during migration: ${ err } ` )
473+ this . logger . error ( `Failed to rename files during migration: ${ err } ` )
472474 throw err
473475 }
474476
475- getLogger ( ) . info ( `codewhisperer: successfully migrated SSO connection to LSP identity server` )
477+ this . logger . info ( ' successfully migrated SSO connection to LSP identity server' )
476478 await memento . update ( key , undefined )
477479 }
478480 }
0 commit comments