Module: BammLog::Formatter

Extended by:
Formatter
Included in:
Formatter
Defined in:
lib/bamm_log/formatter.rb

Instance Method Summary collapse

Instance Method Details

#call_formatted(stamp, msg) ⇒ Object



8
9
10
# File 'lib/bamm_log/formatter.rb', line 8

def call_formatted(stamp, msg)
  "[#{stamp.to_s(:log)}] #{msg}\n"
end

#get_message(msg) ⇒ Object



4
5
6
# File 'lib/bamm_log/formatter.rb', line 4

def get_message(msg)
  "#{String === msg ? msg : msg.inspect}"
end

#included(klass) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/bamm_log/formatter.rb', line 12

def included(klass)
  ::Logger::Formatter.module_eval do
    def call(severity, timestamp, progname, msg)
      Formatter.call_formatted timestamp, Formatter.get_message(msg)
    end
  end
end