Method Name:
debug
Method Signature:
debug(logMessage, *args, **kwargs)
Method Overview:
- debug() method is used to log messages of severity level logging.DEBUG.
Parameters:
logMessge: The message to be logged. To be precise it is the log message
format, since several arguments can be added to it customizing
each log message using the *args and **kwargs parameters
*args: The arguments that can be added to the logMessage using Python string
formatting. *args in Python is used to pass arbitrary number of unnamed arguments.
**kwargs: **kwargs in Python is used to pass arbitrary number of named
arguments or keyword arguments. The debug() method supports 3 named parameters:
They are exc_info, stack_info, and extra.
The exc_info argument is used to add the exception information if any to be added to the log message. To add exception information to the log message the exc_info paramter should evaluate to True.
stack_info argument is used to add the stack information to the log message. To add stack information to the log message the stack_info parameter should evaluate to True.
Example:
import logging# Set the standard log prefixformatString = '%(asctime)s %(message)s'# Set the log level - to DEBUG and abovelogging.basicConfig(level=logging.DEBUG, format=formatString)# Get a logger object with this module nameloggerObject = logging.getLogger(__name__)# Start loggingloggerObject.debug("This is a debug message") |
Output:
2017-03-24 17:26:19,322 This is a debug message |