Every function described above is a top-level export. You can import any of them like this:
import { createLogger } from '@meltwater/mlabs-logger'
Returns a new Pino logger.
To use the production logger, do not set outputMode
, t
, or noop
.
options
(object): Options to pass to Pino. Also supports the following custom options.name
: The name of the logger. Default ismlabs
.base
: Properties to add to the base logger. Will be merged with the default ones added by Pino. Default: no extra properties.useAsync
(boolean): Use the pino destination withsync: false
. OverridescreateDestination
below. Only used in production. Default:false
.createDestination
(function): Function that returns a valid pino [destination parameter] to use in production. If null, this options will be ignored. Default:null
.outputMode
(string): Select an output format to use. May be eithernull
(Pino default output),pretty
(the Pino pretty formatter), or any mode supported by bunyan-formatter:short
,long
,simple
, orbunyan
. Default isnull
.outputFilter
(function): Output filter to use. The function will receive the log message object and should returntrue
if the log should be printed,false
otherwise. This option is ignored when using the production logger. Default is no filter.noop
(boolean): Log all output to debug with the namespace set to the loggername
. This suppresses all output unless theDEBUG
environment variable is set. Default isfalse
.t
(object): The AVA test object to use if running tests. When provided, all logging output will be passed tot.log
. In this mode, the log level may be set via the environment variableLOG_LEVEL
, and the output mode viaLOG_OUTPUT_MODE
.
(object): The Pino logger.
The destination
method from Pino.