class Upfluence::Logger::Formatter
Constants
- LOG_FORMAT
- TIME_FORMAT
Public Class Methods
new(extra = 0)
click to toggle source
# File lib/upfluence/logger.rb, line 9 def initialize(extra = 0) @extra = extra end
Public Instance Methods
call(severity, tstamp, _progname, msg)
click to toggle source
# File lib/upfluence/logger.rb, line 13 def call(severity, tstamp, _progname, msg) LOG_FORMAT % [ severity[0], formatted_time(tstamp), formatted_caller, message_to_str(msg) ] end
formatted_caller()
click to toggle source
# File lib/upfluence/logger.rb, line 28 def formatted_caller caller[4 + @extra].gsub!(/(^.+\/)?(.*):(.*):in `.*'/, '\\2:\\3') end
formatted_time(timestamp)
click to toggle source
# File lib/upfluence/logger.rb, line 24 def formatted_time(timestamp) timestamp.strftime(TIME_FORMAT) end
message_to_str(msg)
click to toggle source
# File lib/upfluence/logger.rb, line 20 def message_to_str(msg) msg.is_a?(String) ? msg : msg.inspect end