JSPM

  • Created
  • Published
  • Downloads 2822
  • Score
    100M100P100Q19753F
  • License MIT

Package Exports

  • @financial-times/n-logger

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@financial-times/n-logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Next Logger Circle CI

Logging utility

Installation

npm install @financial-times/n-logger

Usage

import logger from '@financial-times/n-logger';
logger.info('Saying hello');
logger.warn('Everything’s mostly cool');
logger.error('Uh-oh', { field: 'some value' });

If using CommonJS modules

const logger = require('@financial-times/n-logger').default;

Loggers

By default

  • the console logger is added
    • logger level can be set by CONSOLE_LOG_LEVEL environment variable; defaults to silly
  • the splunk logger is added if NODE_ENV === production

API

  • logger - the Winston object
  • addConsole(level = 'info', opts = {})
  • removeConsole()
  • addSplunk(splunkUrl, level = 'info', opts = {})
  • removeSplunk()
  • clearLoggers()