From dea7e24423adbb8bc0839dedcf1157d6dff6a91b Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 30 Jun 2006 20:43:55 +0000 Subject: oops; adding transaction report class git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1348 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/transaction/report.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/puppet/transaction/report.rb (limited to 'lib/puppet') diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb new file mode 100644 index 000000000..93afa284a --- /dev/null +++ b/lib/puppet/transaction/report.rb @@ -0,0 +1,40 @@ +require 'puppet' + +# A class for reporting what happens on each client. Reports consist of +# two types of data: Logs and Metrics. Logs are the output that each +# change produces, and Metrics are all of the numerical data involved +# in the transaction. +class Puppet::Transaction::Report + attr_accessor :logs, :metrics + + def initialize + @metrics = {} + @logs = [] + + @records = Hash.new do |hash, key| + hash[key] = [] + end + end + + # Create a new metric. + def newmetric(name, hash) + metric = Puppet::Metric.new(name) + + hash.each do |name, value| + metric.newvalue(name, value) + end + + @metrics[metric.name] = metric + end + + # Add a new log message. + def newlog(msg) + @logs << msg + end + + def record(metric, object) + @records[metric] << object + end +end + +# $Id$ -- cgit