-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(logging): fix error when pino pretty is not found
- Loading branch information
uid10804
committed
Dec 14, 2019
1 parent
0384e83
commit f698257
Showing
9 changed files
with
76 additions
and
22 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
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
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
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 |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import * as pino from 'pino'; | ||
|
||
export class Logger { | ||
logger = require('pino')( | ||
{ | ||
prettyPrint: { colorize: true }, | ||
private static instance: pino.Logger; | ||
private constructor() { } | ||
|
||
public static init(prettyPrint = false){ | ||
Logger.instance = pino.default({ | ||
prettyPrint: prettyPrint | ||
}, | ||
process.stderr | ||
); | ||
} | ||
} | ||
|
||
static getInstance():pino.Logger { | ||
if (!Logger.instance) { | ||
return Logger.instance = pino.default({ | ||
prettyPrint: false | ||
}, | ||
process.stderr | ||
); | ||
} | ||
return Logger.instance; | ||
|
||
} | ||
} |
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