lib/franz/logger.rb in franz-1.5.1 vs lib/franz/logger.rb in franz-1.5.2
- old
+ new
@@ -48,14 +48,15 @@
long_format = "%s [%s] %s -- %s\n"
self.formatter = proc do |severity, datetime, _, message|
if colorize
if level == 1
- short_format.colorize(
+ event = { timestamp: Time.now.iso8601(6) }.merge(message)
+ JSON::generate(event).colorize(
color: SEVERITY_COLORS[severity.to_s][0],
background: SEVERITY_COLORS[severity.to_s][1]
- ) % message
+ ) + "\n"
else
long_format.colorize(
color: SEVERITY_COLORS[severity.to_s][0],
background: SEVERITY_COLORS[severity.to_s][1]
) % [
@@ -65,10 +66,11 @@
message
]
end
else # plain
if level == 1
- short_format % message
+ event = { timestamp: Time.now.iso8601(6) }.merge(message)
+ JSON::generate(event) + "\n"
else
long_format % [
severity,
datetime.iso8601(6),
File::basename(caller[4]),
\ No newline at end of file