Class: Semlogger::Printer
Instance Method Summary collapse
- #add(severity, time, progname, data, tags, message) ⇒ Object
-
#initialize(logdev = nil) ⇒ Printer
constructor
A new instance of Printer.
Constructor Details
#initialize(logdev = nil) ⇒ Printer
Returns a new instance of Printer.
19 20 21 22 |
# File 'lib/semlogger/writer.rb', line 19 def initialize logdev = nil @logdev = logdev || $stdout @last_reqid = nil end |
Instance Method Details
#add(severity, time, progname, data, tags, message) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/semlogger/writer.rb', line 24 def add severity, time, progname, data, , line = case [0] when :exception ex = [1] r = "Exception: #{[2]} (#{[1]}" r << "\n\t" << [3].join( "\n\t") if [3] r when :String, :const then [1] else .inspect end reqid = data[:reqid] unless @last_reqid == reqid @last_reqid = reqid puts "\n" end puts line end |