diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-04 16:34:04 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-04 16:34:04 +0000 |
| commit | 30fa686137993ab35fbc135b499f8c5f4ad7ec8b (patch) | |
| tree | fb363c0af14553c4a61c9d303ae843a9e649e1d8 | |
| parent | da0c862bad2aaa8a7b318314c02e8e6d5f98807f (diff) | |
| download | puppet-30fa686137993ab35fbc135b499f8c5f4ad7ec8b.tar.gz puppet-30fa686137993ab35fbc135b499f8c5f4ad7ec8b.tar.xz puppet-30fa686137993ab35fbc135b499f8c5f4ad7ec8b.zip | |
Adding configurability to the syslog facility, using the "logfacility" parameter.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1724 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/puppet.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/log.rb | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb index b4376108c..13e39d503 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -106,6 +106,9 @@ module Puppet self.setdefaults(:puppet, :trace => [false, "Whether to print stack traces on some errors"], + :logfacility => ["daemon", "What syslog facility to use when logging to syslog. + Syslog has a fixed list of valid facilities, and you must choose one of + those; you cannot just make one up."], :statedir => { :default => "$vardir/state", :mode => 01777, :desc => "The directory where Puppet state is stored. Generally, diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index ee825e406..b99108172 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -181,7 +181,12 @@ module Puppet options = Syslog::LOG_PID | Syslog::LOG_NDELAY # XXX This should really be configurable. - facility = Syslog::LOG_DAEMON + str = Puppet[:logfacility] + begin + facility = Syslog.const_get("LOG_#{str.upcase}") + rescue NameError + raise Puppet::Error, "Invalid syslog facility %s" % str + end @syslog = Syslog.open(name, options, facility) end |
