Class: DebDeploy::Logger::Batch
- Inherits:
-
Object
- Object
- DebDeploy::Logger::Batch
- Defined in:
- lib/deb_deploy/logger/batch.rb
Instance Method Summary collapse
- #collect(host, data) ⇒ Object
- #collected ⇒ Object
-
#initialize(logger) ⇒ Batch
constructor
A new instance of Batch.
Constructor Details
#initialize(logger) ⇒ Batch
4 5 6 7 |
# File 'lib/deb_deploy/logger/batch.rb', line 4 def initialize(logger) @messages = {} @logger = logger end |
Instance Method Details
#collect(host, data) ⇒ Object
9 10 11 12 |
# File 'lib/deb_deploy/logger/batch.rb', line 9 def collect(host, data) @messages[host] ||= "" @messages[host] << data end |
#collected ⇒ Object
14 15 16 17 18 19 |
# File 'lib/deb_deploy/logger/batch.rb', line 14 def collected @messages.keys.sort.each do |host| @logger.info "Log for #{host}" @logger.debug @messages[host], host end end |