13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/ree_lib/packages/ree_logger/package/ree_logger/formatters/colorized_formatter.rb', line 13
def format(event, progname = nil)
prefix = if progname
"[#{progname}] "
else
""
end
level = "%-5s" % "#{event.level.to_s}:"
level = colorize_by_level(level, event.level)
out = "#{prefix}%-6s %s" % ["[#{now.strftime("%d/%m/%y %H:%M:%S")}]", colorize_message(level, event.message)]
if not_blank(event.parameters)
out += "#{prefix}\n#{colorize_blue('PARAMETERS:')} #{event.parameters}"
end
if event.exception
backtrace = (event.exception.backtrace || []).join("\n")
out += "#{prefix}\n#{colorize_red('EXCEPTION:')} #{event.exception.class} (#{event.exception.message})\n#{backtrace}"
end
out
end
|