Created
June 12, 2025 17:12
-
-
Save mpslanker/2be63853aa3b0c218628ce861e49c888 to your computer and use it in GitHub Desktop.
Python3 Logging Module BasicConfig Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
# Configure logging to print to the console | |
logging.basicConfig(level=logging.DEBUG) | |
# Create a logger | |
logger = logging.getLogger(__name__) | |
# Log messages at different levels | |
logger.debug("This is a debug message") | |
logger.info("This is an info message") | |
logger.warning("This is a warning message") | |
logger.error("This is an error message") | |
logger.critical("This is a critical message") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment