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 = '' , inspect = null ; message = util . inspect ( args . shift ( ) , { showHidden : true , depth : null } ) . replace ( / \n / g , ' ' ) ; inspect = args [ 0 ] ; if ( args . length > 2 ) { inspect = util . format . apply ( 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 , <mask> : line , debug : inspect } ; if ( bucketDetails . bucket . length !== 0 && bucketDetails . access_key_id . length !== 0 && bucketDetails . secret_access_key . length !== 0 ) { client . write ( util . format ( "%s %s [host=%s] [message=%s] [message.stream] %s\n" , jsonFormat . timestamp , method . toUpperCase ( ) , jsonFormat . hostname , message , JSON . stringify ( jsonFormat ) ) ) ; } else { console . error ( 'Configuration: Sumologic is not configured correctly, please provide `NODE_LOGGER_S3_BUCKET`, `NODE_LOGGER_S3_KEY_ID`, and `NODE_LOGGER_S3_KEY_SECRET` environment variables.' ) ; } }