@gik/tools-logger

0.0.9 • Public • Published

@gik/tools-logger 0.0.9

A wrapper around Pino logger, with some extra features. Part of our tools suite.

Contributors
Supported platforms
  • darwin
  • linux

Table of contents

logger

A wrapper around pino.

Behaviour
  • When the environment is non-production it will output prettier logs.

  • Unless cfg.nothrow is set to true, All calls to error will use @gik/tools-thrower halting the execution when the environment is non-production (ie: development) however, when in production it will always fallback to Pino's default logger.

  • When cfg.extreme is set to true and the environment is set as production it will load extreme-mode adding an even faster approach to logging. (make sure to read the documentation about the caveats)

Parameters
cfg Object The default configuration applied for every environment. additional params
[cfg.name] string The name for the returned logger instance. By default, it will first try to determine the current process' package name, if that fails, then it will use the current process' dirname.
[cfg.level] string The level of debugging that should be used supported levels are, check out logger.Instance for more info. Default info
[cfg.nothrow] boolean Whether log.error should always log instead of throwing in all environments.
[cfg.extreme] boolean Whether Pino should initialize Extreme mode when in production environment.

you can also set the level using the LEVEL environment variable. ~$ LEVEL=info node /path/to/your/file.js.

Returns

Types.Instance - A function that you can use for logging.

Throws
  • Types.ParamTypeError - When parameters are not valid.

▲ Top


Types

Members

▲ Top


ParamTypeError

static typedef of Types

Thrown when invalid parameters are sent to the constructor.

▲ Top


Readme

Keywords

Package Sidebar

Install

npm i @gik/tools-logger

Homepage

gik.mx

Weekly Downloads

2

Version

0.0.9

License

MIT

Last publish

Collaborators

  • etor