@@ -14,6 +14,7 @@ import {
1414 StartLiveTailResponseStream ,
1515} from '@aws-sdk/client-cloudwatch-logs'
1616import { getLogger , ToolkitError } from '../../../shared'
17+ import { uriToKey } from '../cloudWatchLogsUtils'
1718
1819export async function tailLogGroup (
1920 registry : LiveTailSessionRegistry ,
@@ -32,11 +33,11 @@ export async function tailLogGroup(
3233 region : wizardResponse . regionLogGroupSubmenuResponse . region ,
3334 }
3435 const session = new LiveTailSession ( liveTailSessionConfig )
35- if ( registry . has ( session . uri . toString ( ) ) ) {
36+ if ( registry . has ( uriToKey ( session . uri ) ) ) {
3637 await prepareDocument ( session )
3738 return
3839 }
39- registry . set ( session . uri . toString ( ) , session )
40+ registry . set ( uriToKey ( session . uri ) , session )
4041
4142 const document = await prepareDocument ( session )
4243
@@ -49,12 +50,12 @@ export async function tailLogGroup(
4950}
5051
5152export function closeSession ( sessionUri : vscode . Uri , registry : LiveTailSessionRegistry ) {
52- const session = registry . get ( sessionUri . toString ( ) )
53+ const session = registry . get ( uriToKey ( sessionUri ) )
5354 if ( session === undefined ) {
5455 throw new ToolkitError ( `No LiveTail session found for URI: ${ sessionUri . toString ( ) } ` )
5556 }
5657 session . stopLiveTailSession ( )
57- registry . delete ( sessionUri . toString ( ) )
58+ registry . delete ( uriToKey ( sessionUri ) )
5859}
5960
6061export async function clearDocument ( textDocument : vscode . TextDocument ) {
@@ -102,7 +103,7 @@ async function handleSessionStream(
102103 //AbortSignal interrupts the LiveTail stream, causing error to be thrown here.
103104 //Can assume that stopLiveTailSession() has already been called - AbortSignal is only
104105 //exposed through that method.
105- getLogger ( ) . info ( `Session stopped: ${ session . uri . toString ( ) } ` )
106+ getLogger ( ) . info ( `Session stopped: ${ uriToKey ( session . uri ) } ` )
106107 } else {
107108 //Unexpected exception.
108109 session . stopLiveTailSession ( )
0 commit comments