File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,6 +153,9 @@ const logsCommand = new Command<{ endpoint: string }>()
153153
154154 const trpcClient = createTrpcClient ( options . endpoint ) ;
155155
156+ const seenIds = new Set ( ) ;
157+ let onceConnected = false ;
158+
156159 // deno-lint-ignore no-explicit-any
157160 const sub = ( trpcClient . apps as any ) . logs . subscribe ( {
158161 org : gottenApp . org ,
@@ -164,9 +167,20 @@ const logsCommand = new Command<{ endpoint: string }>()
164167 } , {
165168 onData : ( data : "streaming" | null | LogEntry [ ] ) => {
166169 if ( data === "streaming" ) {
167- console . log ( "Streaming logs..." ) ;
170+ if ( ! onceConnected ) {
171+ console . log ( "connected, streaming logs..." ) ;
172+ }
173+ onceConnected = true ;
168174 } else if ( Array . isArray ( data ) ) {
169175 for ( const log of data ) {
176+ const id = log . LogAttributes [ "log.record.uid" ] ;
177+
178+ if ( seenIds . has ( id ) ) {
179+ continue ;
180+ } else {
181+ seenIds . add ( id ) ;
182+ }
183+
170184 let text = `[${ renderTemporalTimestamp ( log . Timestamp ) } ${
171185 log . TraceId ? ` (${ log . TraceId } )` : ""
172186 } ] ${ log . Body } `;
You can’t perform that action at this time.
0 commit comments