|
|
@ -38,6 +38,7 @@ class AnsiFormatter < SemanticLogger::Formatters::Color |
|
|
|
|
|
|
|
def origin = colorize(centerize(log.name), TEXT_CYAN) |
|
|
|
def build_prefix(char) = "#{origin} ╣#{colorize(char)}╠ " |
|
|
|
def build_terminus = "#{origin} #{AnsiFilter::TERMINUS_STRING} " |
|
|
|
def centerize(text) = text.truncate(CENTER_SIZE).center(CENTER_SIZE) |
|
|
|
def colorize(text, tint = color) = "#{tint}#{text}#{CLEAR}" |
|
|
|
def stackisize(items) = items.length.positive? ? "\n#{items.join("\n")}" : '' |
|
|
@ -84,10 +85,17 @@ class AnsiFormatter < SemanticLogger::Formatters::Color |
|
|
|
prefix = log.dimensions ? build_dimensions(log.dimensions) : build_prefix(level_char) |
|
|
|
continuation = build_prefix('┆') |
|
|
|
|
|
|
|
log.dimensions&.before&.times { items.unshift('') } |
|
|
|
log.dimensions&.after&.times { items << '' } |
|
|
|
items.map do |item| |
|
|
|
result = items.map do |item| |
|
|
|
AnsiWrapper.wrap(item, length, prefix, continuation) |
|
|
|
end.compact.join("\n") |
|
|
|
end |
|
|
|
|
|
|
|
if log.dimensions&.terminus |
|
|
|
terminus = AnsiWrapper.wrap(' ', length, build_terminus) |
|
|
|
result << terminus |
|
|
|
end |
|
|
|
|
|
|
|
log.dimensions&.before&.times { result.unshift('') } |
|
|
|
log.dimensions&.after&.times { result << '' } |
|
|
|
result.compact.join("\n") |
|
|
|
end |
|
|
|
end |