Created
January 23, 2015 23:10
-
-
Save damien/0a5d9fd72abe572e1bd8 to your computer and use it in GitHub Desktop.
Nicely formatted logger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger = ActiveSupport::Logger.new(STDOUT) | |
logger.formatter = -> (severity, datetime, progname, msg) { format('[%-5.5{severity} %{timestamp}] %{msg}', severity: severity, timestamp: datetime.to_s(:db), msg: msg) + "\n" } | |
logger.unknown 'foo' | |
logger.fatal 'bar' | |
logger.error 'fizz' | |
logger.warn 'buzz' | |
logger.info 'alice' | |
logger.debug 'bob' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment