Class: Wurk::Logger::Formatters::Base
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Wurk::Logger::Formatters::Base
- Defined in:
- lib/wurk/logger.rb
Constant Summary collapse
- SEVERITY_COLORS =
{ 'DEBUG' => "\e[1;32mDEBUG\e[0m", 'INFO' => "\e[1;34mINFO \e[0m", 'WARN' => "\e[1;33mWARN \e[0m", 'ERROR' => "\e[1;31mERROR\e[0m", 'FATAL' => "\e[1;35mFATAL\e[0m" }.freeze
Instance Method Summary collapse
-
#format_context(ctxt = Wurk::Context.current) ⇒ Object
One buffer, appended in place: the
map/joinit replaces built an Array, a String per pair and the joined String on every line. - #tid ⇒ Object
Instance Method Details
#format_context(ctxt = Wurk::Context.current) ⇒ Object
One buffer, appended in place: the map/join it replaces built an
Array, a String per pair and the joined String on every line. Each
value is appended exactly as "#{value}" renders it — a String or a
Symbol as itself, anything else through interpolation — so the bytes
are unchanged (test/unit/logger_golden_test.rb).
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/wurk/logger.rb', line 40 def format_context(ctxt = Wurk::Context.current) return '' if ctxt.empty? line = +'' ctxt.each do |k, v| line << ' ' append_value(line, k) << '=' v.is_a?(Array) ? line << v.join(',') : append_value(line, v) end line end |