Skip to content

pinojs/pino-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pino-filter

npm version Build Status Coverage Status js-standard-style

Lead maintainer: James Sumners

pino-filter is a transport for Pino that allows filtering of log lines based on logger names, similar to the funtionality of filters in the debug module.

Logs that match any filters are written to stdout. By default, pino-filter will pass through all received logs at the info level or higher. To define filters, a configuration file must be supplied that provides a mapping of filters to log levels. For example, you can supply a simple JSON file:

{
  "levels": {
    "*": "info",
    "foo:bar": "debug",
    "baz:*": "trace"
  }
}

Usage

$ node the-app.js | pino-filter ./config.json

Config

module.exports = {
  levels: {
    '*': 'info', // catch-all filter
    'foo:bar': 'debug',
    'baz:*': 'trace'
  },
  values: {
    fatal: 60,
    error: 50,
    warn: 40,
    info: 30,
    debug: 20,
    trace: 10
  }
}
  • levels: a mapping of filters (keys) to log levels (level names). Note: the wildcard * may only be used at the end of a filter, e.g. foo:* is valid but foo:*:bar is not.
  • values: a mapping of level names to their numeric value. The default is set to the standard Pino levels. If custom levels are defined in the application, those level values should be defined here.

Note: the configuration file can be reloaded at runtime by sending the SIGHUP signal to the pino-filter process.

About

🌲 A transport to filter log lines in the manner of the `debug` module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •