Skip to content

Commit

Permalink
Documented syslog_address and allowed it to accept lists so it works …
Browse files Browse the repository at this point in the history
…with sockets
  • Loading branch information
Stephen Johnson committed Nov 7, 2011
1 parent 7d69c94 commit 2befd01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/tronfig.1
Expand Up @@ -28,6 +28,7 @@ Field are described below:

.IP "Top Level Sections of Configuration"
ssh_options
syslog_address
notification_options
nodes
command_context
Expand All @@ -39,6 +40,13 @@ These options are how we connect to the nodes we run commands on.
agent - (optional) boolean to indicate we should use an SSH Agent
identities - (optional) list of paths to SSH identity files

.IP syslog_address
Include this if you want to enable logging to syslog. Typical values for
various platforms are:
Linux: "/dev/log"
OS X: "/var/run/syslog"
Windows: ["localhost", 514]

.IP notification_options
Who to email failures to.
smtp_host
Expand Down
4 changes: 4 additions & 0 deletions tron/config.py
Expand Up @@ -226,12 +226,16 @@ def _apply_loggers(self, mcp):

new_handlers = []
if hasattr(self, 'syslog_address'):
if not isinstance(self.syslog_address, basestring):
self.syslog_address = tuple(self.syslog_address)

already_exists = False
for h in list(handlers_to_be_removed):
if (isinstance(h, handlers.SysLogHandler) and
h.address == self.syslog_address):
handlers_to_be_removed.remove(h)
already_exists = True

if not already_exists:
new_handlers.append(handlers.SysLogHandler(self.syslog_address))

Expand Down

0 comments on commit 2befd01

Please sign in to comment.