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.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/semantic_logger/formatters/color.rb', line 21

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.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def bold
  @bold
end

#clearObject

Returns the value of attribute clear.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def clear
  @clear
end

#debugObject

Returns the value of attribute debug.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def debug
  @debug
end

#errorObject

Returns the value of attribute error.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def error
  @error
end

#fatalObject

Returns the value of attribute fatal.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def fatal
  @fatal
end

#infoObject

Returns the value of attribute info.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def info
  @info
end

#traceObject

Returns the value of attribute trace.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def trace
  @trace
end

#warnObject

Returns the value of attribute warn.



19
20
21
# File 'lib/semantic_logger/formatters/color.rb', line 19

def warn
  @warn
end

Instance Method Details

#[](level) ⇒ Object



39
40
41
# File 'lib/semantic_logger/formatters/color.rb', line 39

def [](level)
  public_send(level)
end