class Rack::App::Logger

Attributes

id[W]

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/rack/app/logger.rb, line 5
def initialize(*args)
  super
  configure!
end

Protected Instance Methods

configure!() click to toggle source
# File lib/rack/app/logger.rb, line 16
def configure!
  original_formatter = Logger::Formatter.new
  self.formatter = proc do |severity, datetime, progname, msg|
    fmsg = msg.is_a?(::Hash) ? (defined?(::JSON) ? JSON.dump(msg) : msg) : msg
    fprname = progname || id
    original_formatter.call(severity, datetime, fprname, fmsg)
  end
end
id() click to toggle source
# File lib/rack/app/logger.rb, line 12
def id
  @id ||= SecureRandom.hex
end