Object
Default formatter for log messages.
# File ruby-3.1.2/lib/logger/formatter.rb, line 11 def initialize @datetime_format = nil end
# File ruby-3.1.2/lib/logger/formatter.rb, line 15 def call(severity, time, progname, msg) Format % [severity[0..0], format_datetime(time), Process.pid, severity, progname, msg2str(msg)] end
# File ruby-3.1.2/lib/logger/formatter.rb, line 22 def format_datetime(time) time.strftime(@datetime_format || DatetimeFormat) end
# File ruby-3.1.2/lib/logger/formatter.rb, line 26 def msg2str(msg) case msg when ::String msg when ::Exception "#{ msg.message } (#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }" else msg.inspect end end
This page was generated for Ruby 3.1.2
Ruby-doc.org is a service of James Britt and Neurogami, purveyors of fine dance noise.
Generated with Ruby-doc Rdoc Generator 0.42.0.