lib/loga/event.rb in loga-1.4.0 vs lib/loga/event.rb in loga-2.0.0

- old
+ new

@@ -8,9 +8,20 @@ @message = safe_encode(opts[:message]) @timestamp = opts[:timestamp] @type = opts[:type] end + def to_s + output = ["#{timestamp.iso8601(3)} #{message}"] + if exception + output.push exception.to_s + output.push exception.backtrace.join("\n") + end + output.join("\n") + end + + alias inspect to_s + private # Guard against Encoding::UndefinedConversionError # http://stackoverflow.com/questions/13003287/encodingundefinedconversionerror def safe_encode(text)