message-types for string/integer/... is str/const. newline-fixed.

This commit is contained in:
Denis Knauf 2012-05-20 21:11:46 +02:00
parent 431028811e
commit e8223e84a9
2 changed files with 4 additions and 3 deletions

View file

@ -35,7 +35,8 @@ class Semlogger < ::Logger
def format_msg msg
case msg
when String, Numeric, true, false, nil then [msg]
when Numeric, true, false, nil then [:const, msg]
when String then [:str, msg]
when Exception then [:exception, msg.class.name, msg.message.to_s, msg.backtrace]
else [:obj, msg]
end

View file

@ -7,7 +7,7 @@ class Semlogger::Writer < Semlogger::Output
end
def add severity, time, progname, data, tags, message
@logdev.write [severity, time, progname, data, tags, message].to_json
@logdev.write [severity, time, progname, data, tags, message].to_json+"\n"
end
end
@ -24,7 +24,7 @@ class Semlogger::Printer < Semlogger::Output
r = "Exception: #{message[2]} (#{message[1]}"
r << "\n\t" << message[3].join( "\n\t") if message[3]
r
when String, Numeric, true, false, nil then message[0]
when :str, :const then message[1]
when :obj then message[1].inspect
else message.inspect
end