Class: DevSuite::Utils::Logger::Base
- Inherits:
-
Object
- Object
- DevSuite::Utils::Logger::Base
- Defined in:
- lib/dev_suite/utils/logger/base.rb
Constant Summary collapse
- LOG_LEVELS =
[:none, :info, :warn, :error, :debug].freeze
Instance Attribute Summary collapse
-
#log_level ⇒ Object
Returns the value of attribute log_level.
Instance Method Summary collapse
-
#initialize(log_level: :none) ⇒ Base
constructor
A new instance of Base.
-
#log(message, level: :none, emoji: nil, prefix: nil, color: nil) ⇒ Object
Logs a message with optional emoji, prefix, and color.
Constructor Details
#initialize(log_level: :none) ⇒ Base
Returns a new instance of Base.
15 16 17 18 |
# File 'lib/dev_suite/utils/logger/base.rb', line 15 def initialize(log_level: :none) validate_log_level(log_level) @log_level = log_level end |
Instance Attribute Details
#log_level ⇒ Object
Returns the value of attribute log_level.
13 14 15 |
# File 'lib/dev_suite/utils/logger/base.rb', line 13 def log_level @log_level end |
Instance Method Details
#log(message, level: :none, emoji: nil, prefix: nil, color: nil) ⇒ Object
Logs a message with optional emoji, prefix, and color.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dev_suite/utils/logger/base.rb', line 21 def log(, level: :none, emoji: nil, prefix: nil, color: nil) validate_log_level(level) return if skip_logging?(level) = { level: level, emoji: emoji, prefix: prefix, color: color, } = Formatter.format(, ) output_log() end |