import logging # Configure the logging module logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) # Create a logger instance logger = logging.getLogger() # Log a debug message logger.debug('This is a debug message')
import logging # Create a logger instance logger = logging.getLogger() # Log a debug message with extra parameters logger.debug('User %s logged in from %s', 'John', '127.0.0.1')In this example, we create a logger instance without configuring the logging module. Then we use the Logger.debug() method to log a debug message with extra parameters. The extra parameters are passed as arguments to the method after the message string. Package/library: Not applicable as it is a built-in module.