提交 fd03f173 编写于 作者: J Josh Kalderimis 提交者: José Valim

removed default Formatter in logger, not needed with 1.8.7 upwards

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 dad71c60
......@@ -72,44 +72,6 @@ def formatter
@formatter ||= SimpleFormatter.new
end
unless const_defined? :Formatter
class Formatter
Format = "%s, [%s#%d] %5s -- %s: %s\n"
attr_accessor :datetime_format
def initialize
@datetime_format = nil
end
def call(severity, time, progname, msg)
Format % [severity[0..0], format_datetime(time), $$, severity, progname,
msg2str(msg)]
end
private
def format_datetime(time)
if @datetime_format.nil?
time.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec
else
time.strftime(@datetime_format)
end
end
def msg2str(msg)
case msg
when ::String
msg
when ::Exception
"#{ msg.message } (#{ msg.class })\n" <<
(msg.backtrace || []).join("\n")
else
msg.inspect
end
end
end
end
# Simple formatter which only displays the message.
class SimpleFormatter < Logger::Formatter
# This method is invoked when a log event occurs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册