npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

@pubsweet/logger

0.2.18 • Public • Published

@pubsweet/logger

A module encapsulating standard logging features for pubsweet components and services.

Usage

Either:

const myLogger = require('winston') // or something else
const logger = require('@pubsweet/logger')
logger.configure(myLogger)

Or set the logger in config:

const myLogger = require('winston') // or something else
 
{
  'pubsweet-server':{
    logger: myLogger
  }
}

The configured logger can then be imported from anywhere:

const logger = require('@pubsweet/logger')
logger.info('log')

The logger exposes the following methods:

  • info
  • debug
  • error
  • warn
  • configure
  • getRawLogger (returns the logger passed to configure)

As well as:

  • stream (an object for passing to morgan)

Note that the logger used to configure the module must implement error, warn, info and debug functions.

install

npm i @pubsweet/logger

Downloadsweekly downloads

832

version

0.2.18

license

MIT

repository

Gitgitlab

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability