Class: ErpIntegration::Logger
- Inherits:
-
Object
- Object
- ErpIntegration::Logger
- Defined in:
- lib/erp_integration/logger.rb
Overview
The Logger class is a simple wrapper around the logger object.
Instance Method Summary collapse
-
#initialize(logger = nil) ⇒ Logger
constructor
A new instance of Logger.
-
#with_tags(*tags) ⇒ Object
Logs the given tags if the logger is present.
Constructor Details
#initialize(logger = nil) ⇒ Logger
Returns a new instance of Logger.
8 9 10 |
# File 'lib/erp_integration/logger.rb', line 8 def initialize(logger = nil) @logger = logger end |
Instance Method Details
#with_tags(*tags) ⇒ Object
Logs the given tags if the logger is present. If the logger does not respond to ‘tagged`, it logs the tags as an info message.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/erp_integration/logger.rb', line 14 def (*) return yield unless logger if logger.respond_to?(:tagged) logger.tagged(*) { yield } else logger.info("Requested ERP with #{.join(', ')}") yield end end |