Class: Bosh::Director::EventLog::Log
- Defined in:
- lib/bosh/director/event_log.rb
Overview
Job update (mysql_node): update |——– | (2/4) 50%
Instance Method Summary collapse
- #begin_stage(stage_name, total = nil, tags = []) ⇒ Object
-
#initialize(io = nil) ⇒ Log
constructor
A new instance of Log.
- #log_entry(entry) ⇒ Object
-
#log_error(error) ⇒ void
Adds an error entry to the event log.
- #track(task_name = nil, &blk) ⇒ Object
Constructor Details
#initialize(io = nil) ⇒ Log
Returns a new instance of Log.
26 27 28 29 |
# File 'lib/bosh/director/event_log.rb', line 26 def initialize(io = nil) @logger = CustomLogger.new(io || StringIO.new) @last_stage = Stage.new(self, 'unknown', [], 0) end |
Instance Method Details
#begin_stage(stage_name, total = nil, tags = []) ⇒ Object
31 32 33 |
# File 'lib/bosh/director/event_log.rb', line 31 def begin_stage(stage_name, total = nil, = []) @last_stage = Stage.new(self, stage_name, , total) end |
#log_entry(entry) ⇒ Object
52 53 54 |
# File 'lib/bosh/director/event_log.rb', line 52 def log_entry(entry) @logger.info(Yajl::Encoder.encode(entry)) end |
#log_error(error) ⇒ void
This method returns an undefined value.
Adds an error entry to the event log.
42 43 44 45 46 47 48 49 50 |
# File 'lib/bosh/director/event_log.rb', line 42 def log_error(error) @logger.info(Yajl::Encoder.encode( :time => Time.now.to_i, :error => { :code => error.error_code, :message => error., }, )) end |
#track(task_name = nil, &blk) ⇒ Object
35 36 37 |
# File 'lib/bosh/director/event_log.rb', line 35 def track(task_name = nil, &blk) @last_stage.advance_and_track(task_name, &blk) end |