Module: Vector::HLogger

Included in:
Function::FlexibleDownScaling, Function::PredictiveScaling
Defined in:
lib/vector.rb

Constant Summary collapse

@@enabled =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.enable(bool) ⇒ Object



35
36
37
# File 'lib/vector.rb', line 35

def self.enable(bool)
  @@enabled = bool
end

Instance Method Details

#hlog(string) ⇒ Object



47
48
49
50
# File 'lib/vector.rb', line 47

def hlog(string)
  return unless @@enabled
  puts "[#{hlog_ctx_string}] #{string}"
end

#hlog_ctx(ctx, &block) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/vector.rb', line 39

def hlog_ctx(ctx, &block)
  @components ||= []
  @components << ctx
  yield
ensure
  @components.pop
end

#hlog_ctx_stringObject



52
53
54
# File 'lib/vector.rb', line 52

def hlog_ctx_string
  @components.join ','
end