Module: LB::Operation::Log
- Included in:
- LB::Operation
- Defined in:
- lib/lb/operation/log.rb
Overview
Helper for logging
Defined Under Namespace
Modules: ClassInterface
Class Method Summary collapse
-
.included(base) ⇒ Object
Extends base class with class interface.
Instance Method Summary collapse
-
#log(method, *args) ⇒ Object
Calls given logger method with given arguments.
-
#logger ⇒ Object
Retrieves the logger.
Class Method Details
.included(base) ⇒ Object
Extends base class with class interface.
25 26 27 |
# File 'lib/lb/operation/log.rb', line 25 def self.included(base) base.extend ClassInterface end |
Instance Method Details
#log(method, *args) ⇒ Object
Calls given logger method with given arguments.
48 49 50 51 52 53 |
# File 'lib/lb/operation/log.rb', line 48 def log(method, *args) unless logger.respond_to?(method) raise ArgumentError, "Logger does not respond to :#{method}." end logger.public_send(method, *args) end |
#logger ⇒ Object
Retrieves the logger.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lb/operation/log.rb', line 32 def logger result = self.class.logger if result.nil? raise ArgumentError, 'No logger availible: Please set logger via '\ 'LB::Operation::Log[logger] or '\ 'LB::Operation::Log.with_logger(logger)' end result end |