lib/logger.js
function LogWrapper (isLogging) {
  if (this.constructor.name === 'Function') {
    throw new Error('Missing object context')
  }

  if (!isLogging) {
    // stub the logger out
    this.logger = {}

    this.logger.info = function () {}
    this.logger.error = function () {}
    this.logger.warn = function () {}
    return
  }

  // Else config winston for logging
  const Winston = require('winston')

  let winstonTransport = new (Winston.transports.Console)({
    json: false,
    colorize: true
  })

  this.logger = new (Winston.Logger)({
    transports: [winstonTransport]
  })
}
function LogWrapper (isLogging) {
  if (this.constructor.name === 'Function') {
    throw new Error('Missing object context')
  }

  if (!isLogging) {
    // stub the logger out
    this.logger = {}

    this.logger.info = function () {}
    this.logger.error = function () {}
    this.logger.warn = function () {}
    return
  }

  // Else config winston for logging
  const Winston = require('winston')

  let winstonTransport = new (Winston.transports.Console)({
    json: false,
    colorize: true
  })

  this.logger = new (Winston.Logger)({
    transports: [winstonTransport]
  })
}
function LogWrapper ( isLogging ) { if ( this . constructor . name === 'Function' ) { throw new Error ( 'Missing object context' ) } if ( ! isLogging ) { // stub the logger out this . logger = { } this . logger . info = function ( ) { } this . logger . error = function ( ) { } this . logger . warn = function ( ) { } return } // Else config winston for logging const Winston = require ( 'winston' ) let winstonTransport = new ( Winston . transports . Console ) ( { json : false , colorize : true } ) this . logger = new ( Winston . Logger ) ( { transports : [ winstonTransport ] } ) }
Function to be assigned to an objects logger method
@private
@function LogWrapper
Function to be assigned to an objects logger method