lib/threaded_logging.rb in threaded_logging-0.1.0 vs lib/threaded_logging.rb in threaded_logging-0.1.1
- old
+ new
@@ -1,14 +1,15 @@
require "English"
module ThreadedLogging
def call(severity, time, _progname, msg)
- time_string = time.strftime("%Y-%m-%dT%H:%M:%S.") << format("%06d", time.usec)
+ time_string = time.strftime("%Y-%m-%dT%H:%M:%S.%6N")
thread_id = Digest::MD5.hexdigest([Thread.current.object_id, $PID].join)[0...8]
metadata = "#{severity[0]} [#{time_string}] ##{thread_id}:"
+
message = ""
- msg.lines.each { |line| message << "#{metadata} #{line}" }
+ msg.to_s.lines.each { |line| message << "#{metadata} #{line}" }
"#{message}\n"
end
end
::Logger::Formatter.prepend(ThreadedLogging)