Sha256: 5a0950d72b6dd71421130cc08ee256f2f4f6f540be8283a3b6bd295eb4774695
Contents?: true
Size: 739 Bytes
Versions: 3
Compression:
Stored size: 739 Bytes
Contents
# provides a formatter to be used on TTY module Log2mail::LoggerFormatter class <<self LEVELS = ["DEBUG", "INFO", "WARN", "ERROR", "FATAL", "UNKNOWN"] # http://blog.bigbinary.com/2014/03/03/logger-formatting-in-rails.html def msg2str(msg) case msg when ::String msg when ::Exception "#{ msg.message } (#{ msg.class })\n [" << ( $verbose ? \ (msg.backtrace || []).join("#$/ ") : \ (msg.backtrace || []).first ) << ']' else msg.inspect end end def call(severity, datetime, progname, msg) sev = severity.instance_of?(Fixnum) ? LEVELS[severity] : severity '%s: %s' % [sev, msg2str(msg)] + $/ end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
log2mail-0.0.1.pre4 | lib/log2mail/logger_formatter.rb |
log2mail-0.0.1.pre3 | lib/log2mail/logger_formatter.rb |
log2mail-0.0.1.pre2 | lib/log2mail/logger_formatter.rb |