Sha256: 3631eac67ed9ae2b511bbefcc97c88f20c5c8f76f672bf7000523dd0cda50047
Contents?: true
Size: 509 Bytes
Versions: 50
Compression:
Stored size: 509 Bytes
Contents
require 'logger' class Rack::App::Logger < ::Logger attr_writer :id def initialize(*args) super configure! end protected def id @id ||= SecureRandom.hex end 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 end
Version data entries
50 entries across 50 versions & 2 rubygems