Class: Herdsman::LogAdapter
- Inherits:
-
Object
- Object
- Herdsman::LogAdapter
- Defined in:
- lib/herdsman/log_adapter.rb
Constant Summary collapse
- LOG_LEVELS =
{ debug: ::Logger::DEBUG, info: ::Logger::INFO, warn: ::Logger::WARN, error: ::Logger::ERROR, }.freeze
Instance Attribute Summary collapse
-
#writer ⇒ Object
Returns the value of attribute writer.
Instance Method Summary collapse
- #adjust_verbosity(options = {}) ⇒ Object
- #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #info(message) ⇒ Object
-
#initialize(writer) ⇒ LogAdapter
constructor
A new instance of LogAdapter.
- #log_level ⇒ Object
- #log_level=(level) ⇒ Object
- #warn(message) ⇒ Object
Constructor Details
#initialize(writer) ⇒ LogAdapter
Returns a new instance of LogAdapter.
26 27 28 |
# File 'lib/herdsman/log_adapter.rb', line 26 def initialize(writer) @writer = writer end |
Instance Attribute Details
#writer ⇒ Object
Returns the value of attribute writer.
3 4 5 |
# File 'lib/herdsman/log_adapter.rb', line 3 def writer @writer end |
Instance Method Details
#adjust_verbosity(options = {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/herdsman/log_adapter.rb', line 20 def adjust_verbosity( = {}) if [:quiet] self.log_level = :error end end |
#debug(message) ⇒ Object
30 31 32 |
# File 'lib/herdsman/log_adapter.rb', line 30 def debug() writer.debug() end |
#error(message) ⇒ Object
42 43 44 |
# File 'lib/herdsman/log_adapter.rb', line 42 def error() writer.error() end |
#info(message) ⇒ Object
34 35 36 |
# File 'lib/herdsman/log_adapter.rb', line 34 def info() writer.info() end |
#log_level ⇒ Object
12 13 14 |
# File 'lib/herdsman/log_adapter.rb', line 12 def log_level writer.level end |
#log_level=(level) ⇒ Object
16 17 18 |
# File 'lib/herdsman/log_adapter.rb', line 16 def log_level=(level) writer.level = LOG_LEVELS.fetch(level) end |
#warn(message) ⇒ Object
38 39 40 |
# File 'lib/herdsman/log_adapter.rb', line 38 def warn() writer.warn() end |