Class: Puppet::Util::Profiler::Logging Private
- Defined in:
- lib/puppet/util/profiler/logging.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Defined Under Namespace
Classes: Sequence
Instance Method Summary collapse
-
#initialize(logger, identifier) ⇒ Logging
constructor
private
A new instance of Logging.
- #profile(description, &block) ⇒ Object private
Constructor Details
#initialize(logger, identifier) ⇒ Logging
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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
#profile(description, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/puppet/util/profiler/logging.rb', line 8 def profile(description, &block) retval = nil @sequence.next @sequence.down context = start begin retval = yield ensure profile_explanation = finish(context) @sequence.up @logger.call("PROFILE [#{@identifier}] #{@sequence} #{description}: #{profile_explanation}") end retval end |