Handlers¶
Handler
s are what push the finalized log entries to the output streams. They have a common
interface with a default required name
and a write
method.
Streaming¶
Streaming handlers write to basic IO streams, such as STDOUT and STDERR. There is one basic
StreamingHandler
and two convenience handlers that inherit from that: StdOutHandler
and
StdErrHandler
.
Files¶
There is one type of file handler: FileHandler
. This module does not provide handlers for rotating
log files. The rationale behind that is that all *NIX systems have software specifically designed to
do that, and it’s much faster and reliable. Let’s separate concerns here: this logging software is
meant to be both Pythonic and fast. There’s nothing Pythonic or fast about reinventing the wheel. A
great utility for log rotation is logrotate
, which is available for Debian, Red Hat, and BSD systems.
Linux Manpage: https://linux.die.net/man/8/logrotate
FreeBSD Manpage: https://www.freebsd.org/cgi/man.cgi?query=logrotate&manpath=SuSE+Linux/i386+11.3
Sockets¶
Socket handlers write messages to socket connections - these can be anything from internet wide network connections to local filesystem UNIX sockets.
There is one base SocketHandler
type provided by the module. It can be used in a number of
ways to setup any sort of socket based logging. There are several other convenience handlers as well
that have presets for socket families and types.