Class: Semlogger::Writer
Instance Method Summary collapse
- #add(severity, time, progname, data, tags, message) ⇒ Object
-
#initialize(logdev = nil) ⇒ Writer
constructor
A new instance of Writer.
Constructor Details
#initialize(logdev = nil) ⇒ Writer
Returns a new instance of Writer.
5 6 7 8 9 10 11 |
# File 'lib/semlogger/writer.rb', line 5 def initialize logdev = nil @logdev = case logdev when String then ::Semlogger::Rotate.new logdev when nil then ::Semlogger::Rotate.new "log/#{File.basename $0}.%Y-%m-%d.%$.log" else logdev end end |
Instance Method Details
#add(severity, time, progname, data, tags, message) ⇒ Object
13 14 15 |
# File 'lib/semlogger/writer.rb', line 13 def add severity, time, progname, data, , @logdev.write [severity, time.xmlschema(9), progname, data, , ].to_json+"\n" end |