Class: Puppet::Util::Profiler::Logging

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/util/profiler/logging.rb

Direct Known Subclasses

ObjectCounts, WallClock

Defined Under Namespace

Classes: Sequence

Instance Method Summary collapse

Constructor Details

#initialize(logger, identifier) ⇒ Logging

Returns a new instance of Logging.



2
3
4
5
6
# File 'lib/puppet/util/profiler/logging.rb', line 2

def initialize(logger, identifier)
  @logger = logger
  @identifier = identifier
  @sequence = Sequence.new
end

Instance Method Details

#finish(context, description, metric_id) ⇒ Object



14
15
16
17
18
# File 'lib/puppet/util/profiler/logging.rb', line 14

def finish(context, description, metric_id)
  profile_explanation = do_finish(context, description, metric_id)[:msg]
  @sequence.up
  @logger.call("PROFILE [#{@identifier}] #{@sequence} #{description}: #{profile_explanation}")
end

#shutdownObject



20
21
22
# File 'lib/puppet/util/profiler/logging.rb', line 20

def shutdown()
  # nothing to do
end

#start(description, metric_id) ⇒ Object



8
9
10
11
12
# File 'lib/puppet/util/profiler/logging.rb', line 8

def start(description, metric_id)
  @sequence.next
  @sequence.down
  do_start(description, metric_id)
end