@mojaloop/central-services-logger
Mojaloop common logging library
Last updated 3 months ago by l1pcircleci .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mojaloop/central-services-logger 
SYNC missed versions from official npm registry.

central-services-logger

Git Commit Git Releases CircleCI

Common shared Logging lib for Mojaloop components

Configuration

Edit the file in ./config/default.json to configure the logger, or set the following Environment variables:

Environment variable Description Default Available Values
LOG_LEVEL Also CSL_LOG_LEVEL info error, warn, audit, trace, info, perf, verbose, debug, silly
CSL_LOG_LEVEL Sets the log level info error, warn, audit, trace, info, perf, verbose, debug, silly
LOG_FILTER Also CSL_LOG_FILTER "" e.g. `"error, trace, verbose"
CSL_LOG_FILTER Applies a log filter. Specify a comma separated list of individual log levels to be included instead of specifying a LOG_LEVEL "" e.g. `"error, trace, verbose"
CSL_LOG_TRANSPORT Selects the transport method. Either console or file. Uses the same transport for errors and standard logs console console, file
CSL_TRANSPORT_FILE_OPTIONS Optional. Required if LOG_TRANSPORT=file. Configures the winston file transport See default.json See the Winston Docs

Usage

Logger

To use the shared Logger class, you only need to require it in the file you want to perform logging in:

const Logger = require('@mojaloop/central-services-logger')

Then you simply need to call the appropriate method for the logging level you desire:

Logger.debug('this is only a debug statement')
Logger.info('this is some info')
Logger.warn('warning')
Logger.error('an error has occurred')

The Logger class is backed by Winston, which allows you to do things like string interpolation:

Logger.info('test message %s', 'my string');

You can also call the Logger.log method which directly calls the Winston log method and gives even more flexibility.

By default, the Logger class is setup to log to the console only, with timestamps and colorized output.

Current Tags

  • 10.6.0                                ...           latest (3 months ago)
  • 8.8.0                                ...           snapshot (9 months ago)

10 Versions

  • 10.6.0                                ...           3 months ago
  • 10.4.0                                ...           4 months ago
  • 9.5.1                                ...           6 months ago
  • 9.5.0                                ...           6 months ago
  • 9.1.0                                ...           8 months ago
  • 8.8.0                                ...           9 months ago
  • 8.6.0                                ...           a year ago
  • 8.5.2                                ...           a year ago
  • 8.1.2                                ...           a year ago
  • 8.1.1                                ...           a year ago

Copyright 2014 - 2016 © taobao.org |