Created
October 25, 2018 20:36
-
-
Save kitwalker12/22080891c2e9b60dc7d2bf678d4957b7 to your computer and use it in GitHub Desktop.
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
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