Class: SemanticLogger::Formatters::Color::ColorMap

Inherits:
Object
  • Object
show all
Defined in:
lib/semantic_logger/formatters/color.rb

Overview

Supply a custom color map for every log level

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace: AnsiColors::MAGENTA, debug: AnsiColors::GREEN, info: AnsiColors::CYAN, warn: AnsiColors::BOLD, error: AnsiColors::RED, fatal: AnsiColors::RED, bold: AnsiColors::BOLD, clear: AnsiColors::CLEAR) ⇒ ColorMap

Returns a new instance of ColorMap.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/semantic_logger/formatters/color.rb', line 17

def initialize(trace: AnsiColors::MAGENTA,
               debug: AnsiColors::GREEN,
               info: AnsiColors::CYAN,
               warn: AnsiColors::BOLD,
               error: AnsiColors::RED,
               fatal: AnsiColors::RED,
               bold: AnsiColors::BOLD,
               clear: AnsiColors::CLEAR)
  @trace = trace
  @debug = debug
  @info  = info
  @warn  = warn
  @error = error
  @fatal = fatal
  @bold  = bold
  @clear = clear
end

Instance Attribute Details

#boldObject

Returns the value of attribute bold.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def bold
  @bold
end

#clearObject

Returns the value of attribute clear.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def clear
  @clear
end

#debugObject

Returns the value of attribute debug.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def debug
  @debug
end

#errorObject

Returns the value of attribute error.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def error
  @error
end

#fatalObject

Returns the value of attribute fatal.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def fatal
  @fatal
end

#infoObject

Returns the value of attribute info.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def info
  @info
end

#traceObject

Returns the value of attribute trace.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def trace
  @trace
end

#warnObject

Returns the value of attribute warn.



15
16
17
# File 'lib/semantic_logger/formatters/color.rb', line 15

def warn
  @warn
end

Instance Method Details

#[](level) ⇒ Object



35
36
37
# File 'lib/semantic_logger/formatters/color.rb', line 35

def [](level)
  public_send(level)
end