Skip to content

Instantly share code, notes, and snippets.

@unicornware
Last active June 2, 2023 21:57
Show Gist options
  • Select an option

  • Save unicornware/f80f20126cf2a7d7e487860a96bfffb0 to your computer and use it in GitHub Desktop.

Select an option

Save unicornware/f80f20126cf2a7d7e487860a96bfffb0 to your computer and use it in GitHub Desktop.
Pino Logger Configuration
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