Skip to content

Instantly share code, notes, and snippets.

@tasdikrahman
Created July 9, 2020 13:16
Show Gist options
  • Save tasdikrahman/47655821e2938315c3afe63fb096990b to your computer and use it in GitHub Desktop.
Save tasdikrahman/47655821e2938315c3afe63fb096990b to your computer and use it in GitHub Desktop.
# app/logger/log_formatter.rb
class LogFormatter < ::Logger::Formatter
def call(severity, time, program_name, message)
message = '' if message.blank?
severity = '' if message.blank?
{
level: severity,
progname: program_name,
message: message,
}.to_json + "\r\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment