Class: PactBroker::Errors::ErrorLogger
- Inherits:
-
Object
- Object
- PactBroker::Errors::ErrorLogger
- Includes:
- Logging
- Defined in:
- lib/pact_broker/errors/error_logger.rb
Class Method Summary collapse
-
.call(error, error_reference, _env = {}) ⇒ Object
don’t need the env, just in case PF needs it.
- .log_as_warning?(error) ⇒ Boolean
Methods included from Logging
included, #log_error, #log_with_tag, #measure_info
Class Method Details
.call(error, error_reference, _env = {}) ⇒ Object
don’t need the env, just in case PF needs it
10 11 12 13 14 15 16 17 18 |
# File 'lib/pact_broker/errors/error_logger.rb', line 10 def self.call(error, error_reference, _env = {}) if log_as_warning?(error) logger.warn("Error reference #{error_reference}", error) elsif PactBroker::Errors.reportable_error?(error) log_error(error, "Error reference #{error_reference}") else logger.info("Error reference #{error_reference}", error) end end |
.log_as_warning?(error) ⇒ Boolean
20 21 22 |
# File 'lib/pact_broker/errors/error_logger.rb', line 20 def self.log_as_warning?(error) PactBroker.configuration.warning_error_classes.any? { |clazz| error.is_a?(clazz) || error.cause&.is_a?(clazz) } end |