Class: Hatchet::DelegatingFormatter
- Inherits:
-
Object
- Object
- Hatchet::DelegatingFormatter
- Defined in:
- lib/hatchet/delegating_formatter.rb
Overview
Internal: Formatter class that delegates to another formatter implementation. Used within the configuration to make it possible to switch the default formatter at any time.
Instance Attribute Summary collapse
-
#formatter ⇒ Object
Internal: Gets or sets the formatter that is delegated to.
Instance Method Summary collapse
-
#format(level, context, message) ⇒ Object
Public: Returns the formatted message.
-
#initialize(formatter) ⇒ DelegatingFormatter
constructor
Internal: Creates a new instance.
Constructor Details
#initialize(formatter) ⇒ DelegatingFormatter
Internal: Creates a new instance.
formatter - The formatter to delegate to initially.
19 20 21 |
# File 'lib/hatchet/delegating_formatter.rb', line 19 def initialize(formatter) @formatter = formatter end |
Instance Attribute Details
#formatter ⇒ Object
Internal: Gets or sets the formatter that is delegated to.
13 14 15 |
# File 'lib/hatchet/delegating_formatter.rb', line 13 def formatter @formatter end |
Instance Method Details
#format(level, context, message) ⇒ Object
Public: Returns the formatted message.
level - The severity of the log message. context - The context of the log message. message - The message provided by the log caller.
Returns messages as formatted by the formatter being delegated to.
31 32 33 |
# File 'lib/hatchet/delegating_formatter.rb', line 31 def format(level, context, ) @formatter.format(level, context, ) end |