File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 11import type { Logger } from '@mongodb-js/compass-logging/provider' ;
22import { MongoLogWriter } from 'mongodb-log-writer/mongo-log-writer' ;
3- import { PassThrough } from 'stream' ;
3+ import type { Writable } from 'stream' ;
44import { mongoLogId } from '@mongodb-js/compass-logging/provider' ;
55import { useRef } from 'react' ;
66
@@ -62,13 +62,17 @@ export class CompassWebLogger implements Logger {
6262 } ;
6363 }
6464 ) {
65- const passThrough = new PassThrough ( { objectMode : true } ) ;
66- this . log = new MongoLogWriter ( '' , '' , passThrough ) . bindComponent (
67- this . component
68- ) ;
69- passThrough . on ( 'data' , ( line ) => {
70- callbackRef . current . onLog ?.( JSON . parse ( line ) ) ;
71- } ) ;
65+ const target = {
66+ write ( line : string , callback : ( ) => void ) {
67+ callbackRef . current . onLog ?.( JSON . parse ( line ) ) ;
68+ callback ( ) ;
69+ } ,
70+ end ( callback : ( ) => void ) {
71+ callback ( ) ;
72+ } ,
73+ } as Writable ;
74+
75+ this . log = new MongoLogWriter ( '' , '' , target ) . bindComponent ( this . component ) ;
7276
7377 this . debug = createCompassWebDebugger ( this . component , this . callbackRef ) ;
7478 }
You can’t perform that action at this time.
0 commit comments