Class: Bitcoin::Logger::LogWrapper
- Inherits:
-
Object
- Object
- Bitcoin::Logger::LogWrapper
- Defined in:
- lib/bitcoin/logger.rb
Overview
wrap a logger and prepend a special name in front of the messages
Instance Method Summary collapse
-
#initialize(name, log) ⇒ LogWrapper
constructor
A new instance of LogWrapper.
- #method_missing(m, *a, &blk) ⇒ Object
Constructor Details
#initialize(name, log) ⇒ LogWrapper
Returns a new instance of LogWrapper.
61 |
# File 'lib/bitcoin/logger.rb', line 61 def initialize(name, log); @name, @log = name, log; end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &blk) ⇒ Object
62 63 64 |
# File 'lib/bitcoin/logger.rb', line 62 def method_missing(m, *a, &blk) @log.send(m, *a, &proc{ "#{@name} #{blk.call}" }) end |