--- /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/handlers.py 2009-10-08 15:38:51.000000000 -0700 +++ handlers.py 2009-10-08 18:06:38.000000000 -0700 @@ -687,25 +687,30 @@ "CRITICAL" : "critical" } - def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER): + def __init__(self, address=('localhost', SYSLOG_UDP_PORT), + facility=LOG_USER, protocol='udp'): """ Initialize a handler. + If protocol is specified as 'tcp' SysLogHandler will send the syslog + message using TCP. If address is specified as a string, a UNIX socket is used. To log to a local syslogd, "SysLogHandler(address="/dev/log")" can be used. If facility is not specified, LOG_USER is used. """ - logging.Handler.__init__(self) - + logging.Handler.__init__(self) self.address = address self.facility = facility if type(address) == types.StringType: self.unixsocket = 1 self._connect_unixsocket(address) - else: + elif protocol == 'tcp': + self.unixsocket = 0 + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.socket.connect(address) + elif protocol == 'udp': self.unixsocket = 0 self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.formatter = None def _connect_unixsocket(self, address):