Skip to content

Instantly share code, notes, and snippets.

@kitwalker12
Created October 25, 2018 20:36
Show Gist options
  • Save kitwalker12/22080891c2e9b60dc7d2bf678d4957b7 to your computer and use it in GitHub Desktop.
Save kitwalker12/22080891c2e9b60dc7d2bf678d4957b7 to your computer and use it in GitHub Desktop.
class MyLogger < ActiveSupport::TaggedLogging
def initialize(logger)
super(logger)
logger.formatter = formatter
end
def formatter
Proc.new{|severity, time, progname, msg|
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S")
{
severity: severity.to_s,
time: formatted_time,
msg: msg
}.to_json
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment