Created
February 3, 2022 13:00
-
-
Save simonoff/24e1d5fa495fec2e4de863903bbf7f46 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 Sidekiq::Logger::Formatters::Jsoner < Sidekiq::Logger::Formatters::Base | |
def call(severity, time, program_name, message) | |
hash = { | |
application: "prog-sidekiq", | |
time: time.utc.to_i, | |
level: severity, | |
tid: tid, | |
message: message | |
} | |
c = ctx | |
hash["ctx"] = c unless c.empty? | |
::JSON.generate(hash) + "\n" | |
end | |
end | |
Sidekiq.log_formatter = Sidekiq::Logger::Formatters::Jsoner.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment