Class: SemanticLogger::Formatters::Syslog::LevelMap

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

Overview

Default level map for every log level

:fatal => ::Syslog::LOG_CRIT - “A critical condition has occurred” :error => ::Syslog::LOG_ERR - “An error occurred” :warning =>::Syslog::LOG_WARNING - “Warning of a possible problem” :info => ::Syslog::LOG_NOTICE - “A normal but significant condition occurred” :debug => ::Syslog::LOG_INFO - “Informational message” :trace => ::Syslog::LOG_DEBUG - “Debugging information”

The following levels are not used by default. ::Syslog::LOG_EMERG - “System is unusable” ::Syslog::LOG_ALERT - “Action needs to be taken immediately”

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace: ::Syslog::LOG_DEBUG, debug: ::Syslog::LOG_INFO, info: ::Syslog::LOG_NOTICE, warn: ::Syslog::LOG_WARNING, error: ::Syslog::LOG_ERR, fatal: ::Syslog::LOG_CRIT) ⇒ LevelMap

Returns a new instance of LevelMap.



27
28
29
30
31
32
33
34
# File 'lib/semantic_logger/formatters/syslog.rb', line 27

def initialize(trace: ::Syslog::LOG_DEBUG, debug: ::Syslog::LOG_INFO, info: ::Syslog::LOG_NOTICE, warn: ::Syslog::LOG_WARNING, error: ::Syslog::LOG_ERR, fatal: ::Syslog::LOG_CRIT)
  @trace = trace
  @debug = debug
  @info  = info
  @warn  = warn
  @error = error
  @fatal = fatal
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



25
26
27
# File 'lib/semantic_logger/formatters/syslog.rb', line 25

def debug
  @debug
end

#errorObject

Returns the value of attribute error.



25
26
27
# File 'lib/semantic_logger/formatters/syslog.rb', line 25

def error
  @error
end

#fatalObject

Returns the value of attribute fatal.



25
26
27
# File 'lib/semantic_logger/formatters/syslog.rb', line 25

def fatal
  @fatal
end

#infoObject

Returns the value of attribute info.



25
26
27
# File 'lib/semantic_logger/formatters/syslog.rb', line 25

def info
  @info
end

#traceObject

Returns the value of attribute trace.



25
26
27
# File 'lib/semantic_logger/formatters/syslog.rb', line 25

def trace
  @trace
end

#warnObject

Returns the value of attribute warn.



25
26
27
# File 'lib/semantic_logger/formatters/syslog.rb', line 25

def warn
  @warn
end

Instance Method Details

#[](level) ⇒ Object



36
37
38
# File 'lib/semantic_logger/formatters/syslog.rb', line 36

def [](level)
  public_send(level)
end