Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LoggerOptions

Options associated with a Logger instance. Each property is optional, and as such, have sensible defaults.

Hierarchy

  • LoggerOptions

Index

Properties

Optional levels

levels: LoggerLevels

Default:

{ trace: 50, debug: 40, info: 30, warn: 20, error: 10 }

Optional template

template: string

When a log message is not defined, the data associated with it can be used to create the message. For example:

const logger = require('nomatic-logging');
logger.template = '{method} {url} ==> {status} {length} bytes';
logger.log('info', {
 method: 'GET',
 url: '/api/v1/users?page=1',
 status: 200,
 length: 1203
};

The LoggerEntry (sent on execute of each associated transport) would include a message property set to GET /api/v1/users?page=1 ==> 200 1203 bytes.

Optional transports

transports: Transport[]

Transports to associated with the Logger instance.