Search code examples
pythonerror-logging

How to show logging message in Python


I need to show logging messages while debugging what should I do to show messages with the code like this:

logs.out("Here are the error messages")
logs.clear()

Solution

  • You should be using the logging module. Here is an example:

    import logging
    
    logging.debug('debug message')
    logging.info('information message')
    logging.warning('A warning message')
    logging.error('Error Description')
    logging.critical('Critical messages should be here')