Python for Network Engineers

Log to Console, File and SMTP With Logging Module

By George El. • December 2020 • Reading time: 2 minutes

In this post I will show you how to use the logging module to log messages to console, file as well as send email using smtp, depending on the level of the message Create a logger First we will create a logger and set level to DEBUG import logging logger = logging.