@pubsweet/logger

    0.2.61 • Public • Published

    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

    1,165

    Version

    0.2.61

    License

    MIT

    Unpacked Size

    16.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar