lib/formatters.js
function formatTrace(level, context, message, args, err) {

  var recontext = {
    time: (new Date()).toISOString(),
    lvl: level,
    corr: context.corr || notAvailable,
    trans: context.trans || notAvailable,
    op: context.op || notAvailable
  };

  Object.keys(context)
      .filter((key) => {
        return !(context[key] && Object.prototype.toString.call(context[key]) === '[object Function]');
      })
      .forEach((key) => {
        recontext[key] = context[key] || notAvailable;
      });

  if (message instanceof Date || message instanceof Error) {
    // Node6 related hack. See https://github.com/telefonicaid/logops/issues/36
    recontext.msg = util.format(message);
  } else {
    recontext.msg = message;
  }

  var str = Object.keys(recontext)
      .map((key) => key + '=' + recontext[key])
      .join(' | ');

  args.unshift(str);
  if (err && message !== '' + err) {
    args.push(err);
  }

  return util.format.apply(global, args);
}
function formatTrace(level, context, message, args, err) {

  var recontext = {
    time: (new Date()).toISOString(),
    lvl: level,
    corr: context.corr || notAvailable,
    trans: context.trans || notAvailable,
    op: context.op || notAvailable
  };

  Object.keys(context)
      .filter((key) => {
        return !(context[key] && Object.prototype.toString.call(context[key]) === '[object Function]');
      })
      .forEach((key) => {
        recontext[key] = context[key] || notAvailable;
      });

  if (message instanceof Date || message instanceof Error) {
    // Node6 related hack. See https://github.com/telefonicaid/logops/issues/36
    recontext.msg = util.format(message);
  } else {
    recontext.msg = message;
  }

  var str = Object.keys(recontext)
      .map((key) => key + '=' + recontext[key])
      .join(' | ');

  args.unshift(str);
  if (err && message !== '' + err) {
    args.push(err);
  }

  return util.format.apply(global, args);
}
function formatTrace ( level , context , message , args , err ) { var recontext = { time : ( new Date ( ) ) . toISOString ( ) , lvl : level , corr : context . corr || notAvailable , trans : context . trans || notAvailable , op : context . op || notAvailable } ; Object . keys ( context ) . filter ( ( key ) => { return ! ( context [ key ] && Object . prototype . toString . call ( context [ key ] ) === '[object Function]' ) ; } ) . forEach ( ( key ) => { recontext [ key ] = context [ key ] || notAvailable ; } ) ; if ( message instanceof Date || message instanceof Error ) { // Node6 related hack. See https://github.com/telefonicaid/logops/issues/36 recontext . msg = util . format ( message ) ; } else { recontext . msg = message ; } var str = Object . keys ( recontext ) . map ( ( key ) => key + '=' + recontext [ key ] ) . join ( ' | ' ) ; args . unshift ( str ) ; if ( err && message !== '' + err ) { args . push ( err ) ; } return util . format . apply ( global , args ) ; }
Formats a trace message with fields separated by pipes.

DEPRECATED!

@param {String} level One of the following values
['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL']
@param {Object} context Additional information to add to the trace
@param {String} message The main message to be added to the trace
@param {Array} args More arguments provided to the log function
@param {Error|undefined} err A cause error used to log extra information

@return {String} The trace formatted
@deprecated
Formats a trace message with fields separated by pipes .