summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorsawanoboly <sawanoboriyu@higanworks.com>2015-04-23 14:31:08 +0900
committerLamont Granquist <lamont@scriptkiddie.org>2015-05-06 15:09:44 -0700
commit76e5b5a91dd1b92486a8b21a8fcc206ba321f6ab (patch)
tree3650730548bec1c3e0622ac3d61decd019223c24 /lib
parent39df692406d0a9aee28c634584c7f708d8dcd243 (diff)
downloadchef-76e5b5a91dd1b92486a8b21a8fcc206ba321f6ab.tar.gz
send message with Severity to syslog
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/log.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/chef/log.rb b/lib/chef/log.rb
index fc90aba595..a5ba5059ac 100644
--- a/lib/chef/log.rb
+++ b/lib/chef/log.rb
@@ -28,13 +28,19 @@ class Chef
#
# Chef::Log::Syslog class.
# usage in client.rb:
- # log_location Chef::Log::Syslog.new("::Syslog::LOG_DAEMON", "chef-client")
+ # log_location Chef::Log::Syslog.new("chef-client", ::Syslog::LOG_DAEMON)
#
class Syslog < Logger::Syslog
attr_accessor :sync, :formatter
+ def initialize(program_name = 'chef-client', facility = ::Syslog::LOG_DAEMON, logopts=nil)
+ super
+ ::Logger::Syslog.const_set :SYSLOG, SYSLOG
+ end
+
def write(message)
- self << message
+ data = message.match(/(\[.+?\]) ([\w]+):(.*)$/)
+ self.send(data[2].downcase.to_sym, data[3])
end
def close