Class: LogStashLogger::Formatter::Base
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- LogStashLogger::Formatter::Base
- Includes:
- TaggedLogging::Formatter
- Defined in:
- lib/logstash-logger/formatter/base.rb
Direct Known Subclasses
Constant Summary collapse
- FAILED_TO_FORMAT_MSG =
'Failed to format log event'
Instance Attribute Summary collapse
-
#error_logger ⇒ Object
Returns the value of attribute error_logger.
Instance Method Summary collapse
- #call(severity, time, _progname, message) ⇒ Object
-
#initialize(customize_event: nil, error_logger: LogStashLogger.configuration.default_error_logger) ⇒ Base
constructor
A new instance of Base.
Methods included from TaggedLogging::Formatter
#clear_tags!, #current_tags, #pop_tags, #push_tags, #tagged
Constructor Details
#initialize(customize_event: nil, error_logger: LogStashLogger.configuration.default_error_logger) ⇒ Base
Returns a new instance of Base.
17 18 19 20 21 |
# File 'lib/logstash-logger/formatter/base.rb', line 17 def initialize(customize_event: nil, error_logger: LogStashLogger.configuration.default_error_logger) @customize_event = customize_event @error_logger = error_logger super() end |
Instance Attribute Details
#error_logger ⇒ Object
Returns the value of attribute error_logger.
14 15 16 |
# File 'lib/logstash-logger/formatter/base.rb', line 14 def error_logger @error_logger end |
Instance Method Details
#call(severity, time, _progname, message) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/logstash-logger/formatter/base.rb', line 23 def call(severity, time, _progname, ) event = build_event(, severity, time) format_event(event) unless event.cancelled? rescue StandardError => e log_error(e) FAILED_TO_FORMAT_MSG end |