Class: SemanticLogger::Formatters::Syslog::LevelMap
- Inherits:
-
Object
- Object
- SemanticLogger::Formatters::Syslog::LevelMap
- 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
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#error ⇒ Object
Returns the value of attribute error.
-
#fatal ⇒ Object
Returns the value of attribute fatal.
-
#info ⇒ Object
Returns the value of attribute info.
-
#trace ⇒ Object
Returns the value of attribute trace.
-
#warn ⇒ Object
Returns the value of attribute warn.
Class Method Summary collapse
-
.build(level_map) ⇒ Object
Returns [LevelMap] the supplied level map, or a new one with a Hash of overrides applied, for example
{warn: LOG_NOTICE}.
Instance Method Summary collapse
- #[](level) ⇒ Object
-
#initialize(trace: LOG_DEBUG, debug: LOG_INFO, info: LOG_NOTICE, warn: LOG_WARNING, error: LOG_ERR, fatal: LOG_CRIT) ⇒ LevelMap
constructor
A new instance of LevelMap.
Constructor Details
#initialize(trace: LOG_DEBUG, debug: LOG_INFO, info: LOG_NOTICE, warn: LOG_WARNING, error: LOG_ERR, fatal: LOG_CRIT) ⇒ LevelMap
Returns a new instance of LevelMap.
84 85 86 87 88 89 90 91 92 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 84 def initialize(trace: LOG_DEBUG, debug: LOG_INFO, info: LOG_NOTICE, warn: LOG_WARNING, error: LOG_ERR, fatal: LOG_CRIT) @trace = trace @debug = debug @info = info @warn = warn @error = error @fatal = fatal end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
76 77 78 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 76 def debug @debug end |
#error ⇒ Object
Returns the value of attribute error.
76 77 78 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 76 def error @error end |
#fatal ⇒ Object
Returns the value of attribute fatal.
76 77 78 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 76 def fatal @fatal end |
#info ⇒ Object
Returns the value of attribute info.
76 77 78 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 76 def info @info end |
#trace ⇒ Object
Returns the value of attribute trace.
76 77 78 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 76 def trace @trace end |
#warn ⇒ Object
Returns the value of attribute warn.
76 77 78 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 76 def warn @warn end |
Class Method Details
.build(level_map) ⇒ Object
Returns [LevelMap] the supplied level map, or a new one with a Hash of overrides applied,
for example {warn: LOG_NOTICE}.
80 81 82 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 80 def self.build(level_map) level_map.is_a?(LevelMap) ? level_map : new(**level_map) end |
Instance Method Details
#[](level) ⇒ Object
94 95 96 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 94 def [](level) public_send(level) end |