# File lib/puppet/util/instrumentation/listener.rb, line 40 def data { :data => @listener.data } end
# File lib/puppet/util/instrumentation/listener.rb, line 32 def enabled? !!@enabled end
# File lib/puppet/util/instrumentation/listener.rb, line 28 def listen_to?(label) enabled? and (!@pattern || @pattern === label.to_s) end
# File lib/puppet/util/instrumentation/listener.rb, line 36 def name @listener.name.to_s end
# File lib/puppet/util/instrumentation/listener.rb, line 22 def notify(label, event, data) listener.notify(label, event, data) rescue => e warnonce("Error during instrumentation notification: #{e}") end
# File lib/puppet/util/instrumentation/listener.rb, line 44 def to_data_hash { :name => name, :pattern => pattern, :enabled => enabled? } end
# File lib/puppet/util/instrumentation/listener.rb, line 59 def to_pson(*args) to_pson_data_hash.to_pson(*args) end
# File lib/puppet/util/instrumentation/listener.rb, line 52 def to_pson_data_hash { :document_type => "Puppet::Util::Instrumentation::Listener", :data => to_data_hash, } end
# File lib/puppet/util/instrumentation/listener.rb, line 63 def self.from_data_hash(data) result = Puppet::Util::Instrumentation[data["name"]] self.new(result.listener, result.pattern, data["enabled"]) end
# File lib/puppet/util/instrumentation/listener.rb, line 68 def self.from_pson(data) Puppet.deprecation_warning("from_pson is being removed in favour of from_data_hash.") self.from_data_hash(data) end
# File lib/puppet/util/instrumentation/listener.rb, line 15 def initialize(listener, pattern = nil, enabled = false) @pattern = pattern.is_a?(Symbol) ? pattern.to_s : pattern raise "Listener isn't a correct listener (it doesn't provide the notify method)" unless listener.respond_to?(:notify) @listener = listener @enabled = enabled end