Class
Default formatter for log messages.
Constants
No documentation available
No documentation available
Attributes
Read & Write
No documentation available
Class Methods
::
lib/logger/formatter.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/logger/formatter.rb, line 11
def initialize
@datetime_format = nil
end
No documentation available
Instance Methods
lib/logger/formatter.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/logger/formatter.rb, line 15
def call(severity, time, progname, msg)
sprintf(Format, severity, format_datetime(time), Process.pid, severity, progname, msg2str(msg))
end
No documentation available
lib/logger/formatter.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/logger/formatter.rb, line 21
def format_datetime(time)
time.strftime(@datetime_format || DatetimeFormat)
end
No documentation available
lib/logger/formatter.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/logger/formatter.rb, line 25
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
No documentation available