diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-10-26 04:44:25 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-10-26 04:44:25 +0000 |
commit | 0ae5e3392597452acf6a2e9f0d4ac976b8ec9846 (patch) | |
tree | e2307bce0ffacb9bf8ed54b0ebe84632b51fd9b8 /lib/puppet/log.rb | |
parent | 0d3db7984fd40769cbb29cde76e081cb06204710 (diff) | |
download | puppet-0ae5e3392597452acf6a2e9f0d4ac976b8ec9846.tar.gz puppet-0ae5e3392597452acf6a2e9f0d4ac976b8ec9846.tar.xz puppet-0ae5e3392597452acf6a2e9f0d4ac976b8ec9846.zip |
Adding logging methods to all Puppet::Element instances, and converting all instance log statements to use those methods. Additionally modified logging to take advantage of this by including the path of the logging object in the output. Logs will still need some cleanup to avoid duplicate information.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@731 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/log.rb')
-rw-r--r-- | lib/puppet/log.rb | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index 36759e2b4..885260f2e 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -50,15 +50,9 @@ module Puppet end end - def Log.create(level,*ary) - msg = ary.join(" ") - - if @@levels.index(level) >= @@loglevel - return Puppet::Log.new( - :level => level, - :source => "Puppet", - :message => msg - ) + def Log.create(hash) + if @@levels.index(hash[:level]) >= @@loglevel + return Puppet::Log.new(hash) else return nil end @@ -185,7 +179,6 @@ module Puppet "Level is not a string or symbol: #{args[:level].class}" end @message = args[:message] - @source = args[:source] || "Puppet" @time = Time.now # this should include the host name, and probly lots of other # stuff, at some point @@ -201,6 +194,23 @@ module Puppet @path = args[:path] end + if args.include?(:source) + @source = args[:source] + unless defined? @tags and @tags + if @source.respond_to?(:tags) + @tags = @source.tags + end + end + + unless defined? @path and @path + if @source.respond_to?(:path) + @path = @source.path + end + end + else + @source = "Puppet" + end + Log.newmessage(self) end |