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
- #warn_deprecated(message) ⇒ 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
60 61 62 |
# File 'lib/bosh/director/event_log.rb', line 60 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.
50 51 52 53 54 55 56 57 58 |
# File 'lib/bosh/director/event_log.rb', line 50 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 |
#warn_deprecated(message) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/bosh/director/event_log.rb', line 39 def warn_deprecated() log_entry( 'time' => Time.now.to_i, 'type' => 'deprecation', 'message' => , ) end |