Sha256: 6ab346c1cf869d2a833d10c0bc43c0dc62151f45f3092606b448ebdf2c0ad537
Contents?: true
Size: 774 Bytes
Versions: 5
Compression:
Stored size: 774 Bytes
Contents
module Madvertise module Logging ## # MultiLogger is a simple class for multiplexing ImprovedLogger objects. It # support attach/detach to send messages to any number of loggers. class MultiLogger def initialize(*loggers) @loggers = loggers end # Attach an ImprovedLogger object. def attach(logger) logger.token = @loggers.first.token @loggers << logger end # Detach an ImprovedLogger object. def detach(logger) @loggers.delete(logger) end # Delegate all method calls to all attached loggers. # # @private def method_missing(name, *args) @loggers.each do |logger| logger.send(name, *args) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems