nl_tokens: Create a root logger with the name given by name . The object returned from this function is a root logger . The design is that each service component or library will use a single root logger object that s initialised a single time .
pl_tokens: function setupLogger ( name , cfg ) { assume ( name ) . is . a ( 'string' ) ; if ( cfg ) { assume ( cfg ) . is . an ( 'object' ) ; assume ( cfg ) . not . includes ( 'name' ) ; } else { cfg = { } ; } cfg . name = name ; // Sometimes, just make it easy to have everything show the file and line // number.  This is supposed to be quite slow, so the name is what it is to // make it impossible to claim you didn't know it made things slow if ( process . env . FORCE_LOG_LINE_NUMBERS_AND_BE_SLOW === '1' ) { cfg . src = true ; } // We want to be able to override whatever the library or application has // specified by changing only an evironment variable. let envLevel = parseEnvironment ( process . env . LOG_LEVEL , cfg ) ; let oldLevel = cfg . level ; cfg . level = envLevel ; cfg . serializers = { err : bunyan . stdSerializers . err , } ; let logger = bunyan . createLogger ( cfg ) ; // But let's make it clear that we did this by logging if ( oldLevel ) { if ( oldLevel !== envLevel ) { logger . warn ( { requested : oldLevel , used : envLevel , } , 'using log level from environment instead of code' ) ; } } assume ( logger ) . does . not . <mask> ( 'debugCompat' ) ; logger . debugCompat = makeCompat ( logger ) ; return logger ; }