-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce pino as a logger for the CLI
In its current configuration, the logger outputs lines of structured JSON to a file called `checkly.debug.log` in the current directory. This will change later. By default, logs are silenced. Only when you set CHECKLY_LOG_LEVEL, does the log file actually receive any content.
- Loading branch information
Showing
3 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pino from 'pino' | ||
|
||
export const rootLogger = pino( | ||
{ | ||
level: process.env.CHECKLY_LOG_LEVEL || 'silent', | ||
formatters: { | ||
bindings: (bindings) => { | ||
return { pid: bindings.pid } | ||
}, | ||
level: (label) => { | ||
return { level: label.toUpperCase() } | ||
}, | ||
}, | ||
timestamp: pino.stdTimeFunctions.isoTime, | ||
redact: { | ||
paths: [ | ||
'password', | ||
], | ||
}, | ||
}, | ||
pino.destination('checkly.debug.log'), | ||
) | ||
|
||
export type Logger = pino.Logger |