Class: Aspisec::Logger
- Inherits:
-
Object
- Object
- Aspisec::Logger
- Defined in:
- lib-ruby/aspisec/logger.rb
Overview
CLI / Terminal / console information logging
Constant Summary collapse
- LOG_LEVEL =
Mapping integers to log levels from tty-logger (https://github.com/piotrmurach/tty-logger?tab=readme-ov-file#22-levels)
{ 0 => :debug, 1 => :info, 2 => :warn, 3 => :error, 4 => :fatal }.freeze
Instance Attribute Summary collapse
-
#logger ⇒ TTY::Logger
readonly
The configuration of the logger.
Instance Method Summary collapse
-
#initialize(log_level = 2) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(log_level = 2) ⇒ Logger
Returns a new instance of Logger.
25 26 27 |
# File 'lib-ruby/aspisec/logger.rb', line 25 def initialize(log_level = 2) @logger = TTY::Logger.new { |config| config.level = LOG_LEVEL[log_level] } end |
Instance Attribute Details
#logger ⇒ TTY::Logger (readonly)
The configuration of the logger
19 20 21 |
# File 'lib-ruby/aspisec/logger.rb', line 19 def logger @logger end |