summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-03 17:42:16 -0500
committerJames Turnbull <james@lovedthanlost.net>2008-10-04 08:48:44 +1000
commit1c6d57e94196c8238a1609858bad5e5db15d1f0e (patch)
tree08c41964c7c3a1d5a7badb98834a0d084a0965c1 /lib
parenta7744438f83c97886e81990fb34ddcbab8bc0d9e (diff)
downloadpuppet-1c6d57e94196c8238a1609858bad5e5db15d1f0e.tar.gz
puppet-1c6d57e94196c8238a1609858bad5e5db15d1f0e.tar.xz
puppet-1c6d57e94196c8238a1609858bad5e5db15d1f0e.zip
Doing some simple refactorings on Puppet::Log
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util/log.rb21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 35249495d..0dfd36dfa 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -488,26 +488,16 @@ class Puppet::Util::Log
raise ArgumentError, "Level is not a string or symbol: #{args[:level].class}"
end
- # Just return unless we're actually at a level we should send
- #return unless self.class.sendlevel?(@level)
-
@message = args[:message].to_s
@time = Time.now
- # this should include the host name, and probly lots of other
- # stuff, at some point
- unless self.class.validlevel?(level)
- raise ArgumentError, "Invalid message level #{level}"
- end
+
+ raise ArgumentError, "Invalid log level %s" % level unless self.class.validlevel?(level)
if tags = args[:tags]
tags.each { |t| self.tag(t) }
end
- if args.include?(:source)
- self.source = args[:source]
- else
- @source = "Puppet"
- end
+ self.source = args[:source] || "Puppet"
# Tag myself with my log level
tag(level)
@@ -550,5 +540,8 @@ class Puppet::Util::Log
return @message
end
end
-Puppet::Log = Puppet::Util::Log
+# This is for backward compatibility from when we changed the constant to Puppet::Util::Log
+# because the reports include the constant name. Apparently the alias was created in
+# March 2007, should could probably be removed soon.
+Puppet::Log = Puppet::Util::Log