Skip to content

Commit 2f537bb

Browse files
authored
Merge pull request #72 from gradientedge/logger_console
Logger console
2 parents 21898cc + e197c7c commit 2f537bb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/flat-rice-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gradientedge/logger': major
3+
---
4+
5+
Use the Console class as default for the logger transport

packages/logger/src/logger.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { DEFAULT_LOG_LEVEL, LogLevelNumber, VALID_LOGGER_LEVEL_VALUES } from './
22
import { LoggerOptions, LoggerTransport, LoggerLevelValue } from './types'
33
import { generateOutput } from './output'
44
import stringify from 'json-stringify-safe'
5+
import { Console } from 'node:console'
56

67
export class Logger {
78
public baseData: Record<string, any> | null
@@ -22,7 +23,10 @@ export class Logger {
2223
if (options?.transport) {
2324
this.transport = options.transport
2425
} else {
25-
this.transport = { ...console }
26+
this.transport = new Console({
27+
stdout: process.stdout,
28+
stderr: process.stderr,
29+
})
2630
}
2731
}
2832

0 commit comments

Comments
 (0)