Class: Tablexi::Logger::Standard
- Inherits:
-
Object
- Object
- Tablexi::Logger::Standard
- Includes:
- Severities
- Defined in:
- lib/tablexi/logger/standard.rb
Constant Summary
Constants included from Severities
Tablexi::Logger::Severities::SEVERITIES
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
- #call(exception_or_message, options) ⇒ Object
-
#initialize(logger, options = {}) ⇒ Standard
constructor
A new instance of Standard.
Constructor Details
#initialize(logger, options = {}) ⇒ Standard
Returns a new instance of Standard.
11 12 13 14 15 16 17 18 19 |
# File 'lib/tablexi/logger/standard.rb', line 11 def initialize(logger, = {}) defaults = { severity: :unknown } = defaults.merge() severity = [:severity] raise ArgumentError, "Severity `#{severity}` must be one of #{SEVERITIES}" unless SEVERITIES.include?(severity) @logger = logger @severity = severity end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/tablexi/logger/standard.rb', line 8 def logger @logger end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
9 10 11 |
# File 'lib/tablexi/logger/standard.rb', line 9 def severity @severity end |
Instance Method Details
#call(exception_or_message, options) ⇒ Object
21 22 23 |
# File 'lib/tablexi/logger/standard.rb', line 21 def call(, ) logger.public_send severity, generate_log(, ) end |