|
@ -55,7 +55,9 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
wrap_length = IO.console.winsize[1] - FOREMAN_PREFIX - before_message.length + CONTENT_PREFIX.length + 12 |
|
|
wrap_length = IO.console.winsize[1] - FOREMAN_PREFIX - before_message.length + CONTENT_PREFIX.length + 12 |
|
|
message = Wrapper.wrap("#{CONTENT_COLOR_MAP[log.level]}#{message.lstrip}", before_message(true), wrap_length) |
|
|
|
|
|
|
|
|
space_prefix = message.match(/^\s*/) |
|
|
|
|
|
message = Wrapper.wrap("#{CONTENT_COLOR_MAP[log.level]}#{message}", before_message(true, space_prefix), |
|
|
|
|
|
wrap_length - space_prefix.length) |
|
|
|
|
|
|
|
|
"#{CONTENT_COLOR_MAP[log.level]}#{message}#{color_map.clear}" |
|
|
"#{CONTENT_COLOR_MAP[log.level]}#{message}#{color_map.clear}" |
|
|
end |
|
|
end |
|
@ -88,11 +90,11 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
|
|
|
|
|
|
private |
|
|
private |
|
|
|
|
|
|
|
|
def before_message(wrapped = false) |
|
|
|
|
|
|
|
|
def before_message(wrapped = false, prefix = '') |
|
|
result = [name, level, tags, named_tags, duration, CONTENT_PREFIX].compact.join(' ') |
|
|
result = [name, level, tags, named_tags, duration, CONTENT_PREFIX].compact.join(' ') |
|
|
if wrapped |
|
|
if wrapped |
|
|
[name, level, tags, named_tags, duration, |
|
|
[name, level, tags, named_tags, duration, |
|
|
"#{color}#{WRAP_PREFIX}#{color_map.clear}"].compact.join(' ') |
|
|
|
|
|
|
|
|
"#{color}#{WRAP_PREFIX}#{color_map.clear}#{prefix}"].compact.join(' ') |
|
|
else |
|
|
else |
|
|
[name, level, tags, named_tags, duration, |
|
|
[name, level, tags, named_tags, duration, |
|
|
CONTENT_PREFIX].compact.join(' ') |
|
|
CONTENT_PREFIX].compact.join(' ') |
|
|