You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logger=Ougai::Logger.new(STDOUT)logger.level=Logger::INFOerror_logger=Ougai::Logger.new('./error.log')error_logger.level=Logger::ERRORlogger.extendOugai::Logger.broadcast(error_logger)# start a child loggerchild_logger=logger.child(child: true)loggechild_loggerr.info('Hello!')child_logger.error('Failed to do something.')child_logger.level=Logger::WARN# error_logger level is also set WARN by propagationchild_logger.warn('Ignored something.')
Stdout output
{"name":"test","hostname":"karl-pietrzaks-mbp.local","pid":73910,"level":30,"time":"2022-08-18T15:56:24.014-04:00","v":0,"msg":"Hello!","child":true}
{"name":"test","hostname":"karl-pietrzaks-mbp.local","pid":73910,"level":50,"time":"2022-08-18T15:56:24.014-04:00","v":0,"msg":"Failed to do something.","child":true}
{"name":"test","hostname":"karl-pietrzaks-mbp.local","pid":73910,"level":40,"time":"2022-08-18T15:56:24.015-04:00","v":0,"msg":"Ignored something.","child":true}
error.log
# Logfile created on 2022-08-18 15:56:08 -0400 by logger.rb/66358
Is this intentional? I assumed creating a child logger would broadcast as well. Thoughts?
Use Case
I have a central setup_logging.rb file that sets up multiple loggers, and then:
each module require's setup_logging
sets up a child logger for itself
The text was updated successfully, but these errors were encountered:
From the README, but using
.child()
:Stdout output
error.log
Is this intentional? I assumed creating a child logger would broadcast as well. Thoughts?
Use Case
I have a central
setup_logging.rb
file that sets up multiple loggers, and then:setup_logging
The text was updated successfully, but these errors were encountered: