A handler class which sends formatted logging records to a syslog server. Based on Sam Rushing's syslog module: http://www.nightmare.com/squirl/python-ext/misc/syslog.py Contributed by Nicolas Untz (after which minor refactoring changes have been made).
There are no implemented interfaces.
LOG_ALERT
(type:
int
)
1
LOG_AUTH
(type:
int
)
4
LOG_AUTHPRIV
(type:
int
)
10
LOG_CRIT
(type:
int
)
2
LOG_CRON
(type:
int
)
9
LOG_DAEMON
(type:
int
)
3
LOG_DEBUG
(type:
int
)
7
LOG_EMERG
(type:
int
)
0
LOG_ERR
(type:
int
)
3
LOG_INFO
(type:
int
)
6
LOG_KERN
(type:
int
)
0
LOG_LOCAL0
(type:
int
)
16
LOG_LOCAL1
(type:
int
)
17
LOG_LOCAL2
(type:
int
)
18
LOG_LOCAL3
(type:
int
)
19
LOG_LOCAL4
(type:
int
)
20
LOG_LOCAL5
(type:
int
)
21
LOG_LOCAL6
(type:
int
)
22
LOG_LOCAL7
(type:
int
)
23
LOG_LPR
(type:
int
)
6
LOG_MAIL
(type:
int
)
2
LOG_NEWS
(type:
int
)
7
LOG_NOTICE
(type:
int
)
5
LOG_SYSLOG
(type:
int
)
5
LOG_USER
(type:
int
)
1
LOG_UUCP
(type:
int
)
8
LOG_WARNING
(type:
int
)
4
facility_names
(type:
dict
)
{'kern': 0, 'daemon': 3, 'uucp': 8, 'local7': 23, 'local4': 20, 'lpr': 6, 'auth': 4, 'local0': 16, 'cron': 9, 'syslog': 5, 'user': 1, 'news': 7, 'local5': 21, 'mail': 2, 'security': 4, 'local6': 22, 'local1': 17, 'authpriv': 10, 'local3': 19, 'local2': 18}
log_format_string
(type:
str
)
'<%d>%s\x00'
priority_names
(type:
dict
)
{'info': 6, 'notice': 5, 'err': 3, 'warning': 4, 'alert': 1, 'warn': 4, 'debug': 7, 'critical': 2, 'error': 3, 'crit': 2, 'panic': 0, 'emerg': 0}
acquire()
Acquire the I/O thread lock.
addFilter(filter)
Add the specified filter to this handler.
close()
Closes the socket.
createLock()
Acquire a thread lock for serializing access to the underlying I/O.
emit(record)
Emit a record.
The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server.
encodePriority(facility, priority)
Encode the facility and priority. You can pass in strings or integers - if strings are passed, the facility_names and priority_names mapping dictionaries are used to convert them to integers.
filter(record)
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.
flush()
Ensure all logging output has been flushed.
This version does nothing and is intended to be implemented by subclasses.
format(record)
Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter for the module.
handle(record)
Conditionally emit the specified logging record.
Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission.
handleError(record)
Handle errors which occur during an emit() call.
This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method.
release()
Release the I/O thread lock.
removeFilter(filter)
Remove the specified filter from this handler.
setFormatter(fmt)
Set the formatter for this handler.
setLevel(level)
Set the logging level of this handler.
There are no known subclasses.