Class
Default formatter for log messages.
Constants
No documentation available
Attributes
Read & Write
No documentation available
Class Methods
::
lib/logger.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/logger.rb, line 592
def initialize
@datetime_format = nil
end
No documentation available
Instance Methods
lib/logger.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/logger.rb, line 596
def call(severity, time, progname, msg)
Format % [severity[0..0], format_datetime(time), $$, severity, progname,
msg2str(msg)]
end
No documentation available
lib/logger.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/logger.rb, line 603
def format_datetime(time)
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ".freeze)
end
No documentation available
lib/logger.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/logger.rb, line 607
def msg2str(msg)
case msg
when ::String
msg
when ::Exception
"#{ msg.message } (#{ msg.class })\n" <<
(msg.backtrace || []).join("\n")
else
msg.inspect
end
end
No documentation available