Class: SimpleLogger
- Inherits:
-
Object
- Object
- SimpleLogger
- Defined in:
- lib/gem_checks/simple_logger.rb
Constant Summary collapse
- LOG_LEVELS =
[:debug, :info, :warn, :error, :fatal, :unknown].freeze
Instance Attribute Summary collapse
-
#level ⇒ Object
writeonly
Sets the attribute level.
Instance Method Summary collapse
- #debug ⇒ Object
- #error ⇒ Object
- #fatal ⇒ Object
- #info ⇒ Object
-
#initialize(default_level: :debug) ⇒ SimpleLogger
constructor
A new instance of SimpleLogger.
- #unknown ⇒ Object
- #warn ⇒ Object
Constructor Details
#initialize(default_level: :debug) ⇒ SimpleLogger
Returns a new instance of SimpleLogger.
6 7 8 |
# File 'lib/gem_checks/simple_logger.rb', line 6 def initialize(default_level: :debug) @level = LOG_LEVELS.index(default_level) end |
Instance Attribute Details
#level=(value) ⇒ Object (writeonly)
Sets the attribute level
2 3 4 |
# File 'lib/gem_checks/simple_logger.rb', line 2 def level=(value) @level = value end |
Instance Method Details
#debug ⇒ Object
10 11 12 |
# File 'lib/gem_checks/simple_logger.rb', line 10 def debug(*) log_if_level_valid(:debug) end |
#error ⇒ Object
22 23 24 |
# File 'lib/gem_checks/simple_logger.rb', line 22 def error(*) log_level_if_valid(:error) end |
#fatal ⇒ Object
26 27 28 |
# File 'lib/gem_checks/simple_logger.rb', line 26 def fatal(*) log_level_if_valid(:fatal) end |
#info ⇒ Object
14 15 16 |
# File 'lib/gem_checks/simple_logger.rb', line 14 def info(*) log_if_level_valid(:info) end |
#unknown ⇒ Object
30 31 32 |
# File 'lib/gem_checks/simple_logger.rb', line 30 def unknown(*) log_level_if_valid(:unknown) end |
#warn ⇒ Object
18 19 20 |
# File 'lib/gem_checks/simple_logger.rb', line 18 def warn(*) log_if_level_valid(:warn) end |