Class: GreenLog::ClassicLogger
- Inherits:
-
Object
- Object
- GreenLog::ClassicLogger
- Includes:
- SeverityThresholdSupport
- Defined in:
- lib/green_log/classic_logger.rb
Overview
An alternative to ‘GreenLog::Logger` for older code, which implements the same interface as the built-in Ruby `::Logger`.
Instance Attribute Summary collapse
-
#downstream ⇒ Object
readonly
Returns the value of attribute downstream.
Instance Method Summary collapse
- #add(severity, message = :unspecified, &block) ⇒ Object
-
#initialize(downstream) ⇒ ClassicLogger
constructor
A new instance of ClassicLogger.
Methods included from SeverityThresholdSupport
Constructor Details
#initialize(downstream) ⇒ ClassicLogger
Returns a new instance of ClassicLogger.
14 15 16 |
# File 'lib/green_log/classic_logger.rb', line 14 def initialize(downstream) @downstream = downstream end |
Instance Attribute Details
#downstream ⇒ Object (readonly)
Returns the value of attribute downstream.
18 19 20 |
# File 'lib/green_log/classic_logger.rb', line 18 def downstream @downstream end |
Instance Method Details
#add(severity, message = :unspecified, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/green_log/classic_logger.rb', line 22 def add(severity, = :unspecified, &block) severity = Integer(severity) return if severity < severity_threshold entry = Entry.build(severity, (, &block)) downstream << entry true end |