Last active
June 2, 2023 21:57
-
-
Save unicornware/f80f20126cf2a7d7e487860a96bfffb0 to your computer and use it in GitHub Desktop.
Pino Logger Configuration
This file contains hidden or 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
| import pino from 'pino' | |
| /** | |
| * @file Pino Logger Configuration | |
| * @module logger | |
| * | |
| * @see {@link https://github.com/pinojs/pino} | |
| * @see {@link https://github.com/pinojs/pino-pretty} | |
| * @see {@link https://docs.feathersjs.com/api/errors.html} | |
| */ | |
| export const Logger = pino({ | |
| level: 'debug', | |
| prettyPrint: { | |
| colorize: true, | |
| errorProps: 'className,code,data,errors,message,name', | |
| ignore: 'hostname,pid', | |
| levelFirst: true, | |
| translateTime: true | |
| } | |
| }) | |
| /** | |
| * Returns a Pino child logger. | |
| * Every log will have a `namespace` key with the value of {@param namespace}. | |
| * | |
| * @param namespace - Log namespace | |
| */ | |
| const log = (namespace: string): pino.Logger => Logger.child({ namespace }) | |
| export default log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment