Sending e-mails via the logging module

In any modern programming language, the logging facilities are provided with common features. Similarly, Python's logging module is very rich in features and flexibilities. We can use the different types of log handlers with the logging module, such as the console or the file logging handler. One way in which you can maximize your logging benefits is by e-mailing the log messages to the user just as the log is being produced. Python's logging module provides a type of handler called BufferingHandler, which is capable of buffering the log data.

An example of extending BufferingHandler has been displayed later. A child class called BufferingSMTPHandler is defined by BufferingHandler. In this example, an instance ...

Get Learning Python Network Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.