Skip to content

Commit 1b7f0e6

Browse files
Don't log to stdout/stderr by default from SDK (#140)
1 parent 1332a9b commit 1b7f0e6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/databricks-sdk-js/src/logging/DefaultLogger.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
import {Writable} from "stream";
1+
import {Transform, Writable} from "stream";
22
import {LogEntry, Logger} from "./types";
33

44
export class DefaultLogger implements Logger {
55
private _stream: Writable;
66
constructor(outputStream?: Writable) {
7-
this._stream = outputStream ?? process.stderr;
7+
//set to noop if no stream specified
8+
this._stream =
9+
outputStream ??
10+
new (class extends Writable {
11+
_write(
12+
chunk: any,
13+
encoding: BufferEncoding,
14+
callback: (error?: Error | null | undefined) => void
15+
): void {
16+
callback();
17+
}
18+
})();
819
}
920

1021
log(level: string, message?: string, obj?: any) {

0 commit comments

Comments
 (0)