Skip to content

A abstraction of the pino logger to support standard output, file output and rotating file output by the options object.

Notifications You must be signed in to change notification settings

jvddavid/logger

Repository files navigation

Logger

A abstraction of the pino logger to support standard output, file output and rotating file output by the options object.

Install

npm i @jvddavid/logger

Use

const logger = new Logger({
  name: 'demo',
  level: 'info',
  standard: {
    enabled: true,
    pretty: true
  },
  files: [
    {
      path: 'logs/demo.log',
      pretty: {
        enabled: true,
        colorize: true
      },
      level: 'info'
    }
  ],
  folders: [
    {
      folder: 'logs',
      pattern: 'log-%Y-%M-%d-%N.log',
      maxSize: 10 * 1024 * 1024,
      level: 'info'
    }
  ]
})
logger.log(
  {
    message: 'Hello, world!'
  },
  'Hello, world!'
)

About

A abstraction of the pino logger to support standard output, file output and rotating file output by the options object.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published