Class: Hatchet::PlainFormatter
- Inherits:
-
Object
- Object
- Hatchet::PlainFormatter
- Includes:
- BacktraceFormatter
- Defined in:
- lib/hatchet/plain_formatter.rb
Overview
Public: Plain formatter class. Outputs messages with just the given message.
Useful for Rails in development mode where the log messages are intended to be human readable rather than useful for grepping, etc.
Instance Attribute Summary
Attributes included from BacktraceFormatter
Instance Method Summary collapse
-
#format(level, context, message) ⇒ Object
Public: Returns the formatted message.
-
#initialize ⇒ PlainFormatter
constructor
Public: Initialize a new instance.
Methods included from BacktraceFormatter
Constructor Details
#initialize ⇒ PlainFormatter
Public: Initialize a new instance.
15 16 17 |
# File 'lib/hatchet/plain_formatter.rb', line 15 def initialize @backtrace = true 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 in the format:
MESSAGE
BACKTRACE
The backtrace is only present if the message contains an error.
32 33 34 |
# File 'lib/hatchet/plain_formatter.rb', line 32 def format(level, context, ) with_backtrace(, .to_s) end |