nl_tokens: Each logger actually has some secondary loggers attached to it for stats . This helper wires them up .
pl_tokens: function wrapLogger ( getLoggerForConfig , opts ) { var mainLogger = getLoggerForConfig ( 'main' , opts ) , timeLogger = getLoggerForConfig ( 'time' , opts ) , gaugeLogger = getLoggerForConfig ( 'gauge' , opts ) , classifyTime = makeTimeClassifier ( opts ) , classifyGauge = makeGaugeClassifier ( opts ) // These are methods that are exposed on the primary logger. // They just dispatch to appropriate log levels on secondary loggers. mainLogger . time = ( token , ms , opts ) => timeLogger [ classifyTime ( ms , opts ) ] ( token , { ms } ) ; mainLogger . gauge = ( token , val , opts ) => gaugeLogger [ classifyGauge ( val , opts ) ] ( token , { val } ) ; // Expose these. mainLogger . timeLogger = timeLogger ; mainLogger . gaugeLogger = gaugeLogger ; // This is just a convenience wrapper around the `time` method. mainLogger . timer = ( token , opts ) => { var t0 = new Date // For use by `timer.stop`. , tt = t0 // For use by `timer.tick`. , nt = 0 // Number of times `tick` has been called. , ct = 0 // For storing return values. return { // The `stop` method logs the total elapsed time since // timer creation. stop : ( ) => ( mainLogger . time ( token , ct = <mask> Date - t0 , opts ) , ct ) , // The `tick` method logs the time elapsed since the // last call to `tick` (or since timer creation).  A // tick may be named.  If a name is not passed in the // number of times `tick` has been called on this // timer will be used.  Don't mix named and un-named // ticks. tick : ( name ) => { var now = new Date name || ( name = ` ${ nt ++ } ` ) ; mainLogger . time ( ` ${ token } ${ name } ` , ct = now - tt , opts ) ; tt = now ; return ct } , } ; } return mainLogger ; }