Class: Bosh::Director::ProblemScanner::EventLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/problem_scanner/scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(event_log, logger) ⇒ EventLogger

Returns a new instance of EventLogger.



68
69
70
71
72
# File 'lib/bosh/director/problem_scanner/scanner.rb', line 68

def initialize(event_log, logger)
  @event_log = event_log
  @logger = logger
  @event_log_stage = nil
end

Instance Method Details

#begin_stage(stage_name, n_steps) ⇒ Object



74
75
76
77
# File 'lib/bosh/director/problem_scanner/scanner.rb', line 74

def begin_stage(stage_name, n_steps)
  @event_log_stage = @event_log.begin_stage(stage_name, n_steps)
  @logger.info(stage_name)
end

#track_and_log(task, log = true) ⇒ Object



79
80
81
82
83
84
# File 'lib/bosh/director/problem_scanner/scanner.rb', line 79

def track_and_log(task, log = true)
  @event_log_stage.advance_and_track(task) do |ticker|
    @logger.info(task) if log
    yield ticker if block_given?
  end
end