lib/index.js
function logEvent(ctx, data, request) {
  if (!data) return;

  var obj = {};
  var msg = '';

  if (ctx.includeTags && Array.isArray(data.tags)) {
    obj.tags = ctx.joinTags ? data.tags.join(ctx.joinTags) : data.tags;
  }

  if (request) obj.req_id = request.id;

  if (data instanceof Error) {
    ctx.log.child(obj)[ctx.level](data);
    return;
  }

  var type = typeof data.data;

  if (type === 'string') {
    msg = data.data;
  } else if (ctx.includeData && data.data !== undefined) {
    if (ctx.mergeData && type === 'object' && !Array.isArray(data.data)) {
      lodash.assign(obj, data.data);

      if (obj.id === obj.req_id) delete obj.id;
    } else {
      obj.data = data.data;
    }
  } else if (ctx.skipUndefined) {
    return;
  }

  ctx.log[ctx.level](obj, msg);
}
function logEvent(ctx, data, request) {
  if (!data) return;

  var obj = {};
  var msg = '';

  if (ctx.includeTags && Array.isArray(data.tags)) {
    obj.tags = ctx.joinTags ? data.tags.join(ctx.joinTags) : data.tags;
  }

  if (request) obj.req_id = request.id;

  if (data instanceof Error) {
    ctx.log.child(obj)[ctx.level](data);
    return;
  }

  var type = typeof data.data;

  if (type === 'string') {
    msg = data.data;
  } else if (ctx.includeData && data.data !== undefined) {
    if (ctx.mergeData && type === 'object' && !Array.isArray(data.data)) {
      lodash.assign(obj, data.data);

      if (obj.id === obj.req_id) delete obj.id;
    } else {
      obj.data = data.data;
    }
  } else if (ctx.skipUndefined) {
    return;
  }

  ctx.log[ctx.level](obj, msg);
}
function logEvent ( ctx , data , request ) { if ( ! data ) return ; var obj = { } ; var msg = '' ; if ( ctx . includeTags && Array . isArray ( data . tags ) ) { obj . tags = ctx . joinTags ? data . tags . join ( ctx . joinTags ) : data . tags ; } if ( request ) obj . req_id = request . id ; if ( data instanceof Error ) { ctx . log . child ( obj ) [ ctx . level ] ( data ) ; return ; } var type = typeof data . data ; if ( type === 'string' ) { msg = data . data ; } else if ( ctx . includeData && data . data !== undefined ) { if ( ctx . mergeData && type === 'object' && ! Array . isArray ( data . data ) ) { lodash . assign ( obj , data . data ) ; if ( obj . id === obj . req_id ) delete obj . id ; } else { obj . data = data . data ; } } else if ( ctx . skipUndefined ) { return ; } ctx . log [ ctx . level ] ( obj , msg ) ; }
Event logger.
Event logger .