src/lib/logger.js
function print(type, msg, obj, colors) {
  if (typeof type === 'number') {
    type = calculateLevel(type);
  }
  const finalMessage = fillInMsgTemplate(msg, obj, colors);

  const subsystems = [
    {
      in: green('<--'),
      out: yellow('-->'),
      fs: black('-=-'),
      default: blue('---'),
    },
    {
      in: '<--',
      out: '-->',
      fs: '-=-',
      default: '---',
    },
  ];

  const sub = subsystems[colors ? 0 : 1][obj.sub] || subsystems[+!colors].default;
  if (colors) {
    return ` ${levels[type](pad(type))}${white(`${sub} ${finalMessage}`)}`;
  } else {
    return ` ${pad(type)}${sub} ${finalMessage}`;
  }
}
function print(type, msg, obj, colors) {
  if (typeof type === 'number') {
    type = calculateLevel(type);
  }
  const finalMessage = fillInMsgTemplate(msg, obj, colors);

  const subsystems = [
    {
      in: green('<--'),
      out: yellow('-->'),
      fs: black('-=-'),
      default: blue('---'),
    },
    {
      in: '<--',
      out: '-->',
      fs: '-=-',
      default: '---',
    },
  ];

  const sub = subsystems[colors ? 0 : 1][obj.sub] || subsystems[+!colors].default;
  if (colors) {
    return ` ${levels[type](pad(type))}${white(`${sub} ${finalMessage}`)}`;
  } else {
    return ` ${pad(type)}${sub} ${finalMessage}`;
  }
}
function print ( type , msg , obj , colors ) { if ( typeof type === 'number' ) { type = calculateLevel ( type ) ; } const finalMessage = fillInMsgTemplate ( msg , obj , colors ) ; const subsystems = [ { in : green ( '<--' ) , out : yellow ( '-->' ) , fs : black ( '-=-' ) , default : blue ( '---' ) , } , { in : '<--' , out : '-->' , fs : '-=-' , default : '---' , } , ] ; const sub = subsystems [ colors ? 0 : 1 ] [ obj . sub ] || subsystems [ + ! colors ] . default ; if ( colors ) { return ` ${ levels [ type ] ( pad ( type ) ) } ${ white ( ` ${ sub } ${ finalMessage } ` ) } ` ; } else { return ` ${ pad ( type ) } ${ sub } ${ finalMessage } ` ; } }
Apply colors to a string based on level parameters.
@param {*} type
@param {*} msg
@param {*} obj
@param {*} colors
@return {String}
Apply colors to a string based on level parameters .