nl_tokens: Delegate function for each log level
pl_tokens: function delegate ( method , _args ) { var callPosition = metalogger . callposition ( ) , file , line ; if ( ! metalogger . shouldLog ( method , _level ) ) { return ; } var args = Array . prototype . slice . call ( _args ) ; var message = [ ] ; if ( args . length === 1 ) { message . push ( util . inspect ( args [ 0 ] , { showHidden : true , depth : null } ) ) ; } if ( args . length === 2 ) { message . push ( args . shift ( ) ) ; message . push ( util . inspect ( args [ 0 ] , { showHidden : true , depth : null } ) ) ; } if ( args . length > 2 ) { message . push ( args . shift ( ) ) ; message . push ( util . format . <mask> ( null , args ) ) ; } try { file = callPosition . split ( ':' ) [ 0 ] . replace ( ' [' , '' ) ; line = callPosition . split ( ':' ) [ 1 ] . replace ( '] ' , '' ) ; } catch ( e ) { // something went wrong with stack trace } var jsonFormat = { timestamp : ( new Date ( ) ) . toISOString ( ) , hostname : os . hostname ( ) , level : method , file : file , line : line , message : message . join ( ' ' ) } ; if ( options . token ) { client . log ( jsonFormat , function ( err ) { if ( err ) { console . error ( 'error occured while logging to loggly' , err ) ; } } ) ; } else { console . error ( 'Loggly auth token not provided' ) ; } }