Python sets the level of error reporting, as in PHP

How to set error reports and warnings in Python, as in PHP error_reporting(E_LEVEL)?

+3
source share
1 answer

A vaguely related option would be to set the level in the loggingmodule of the Python standard library, and I quote from Python docs:

import logging
LOG_FILENAME = 'example.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)

logging.debug('This message should go to the log file')

, level= , . ( ), logging, (, ), - ; ( , , ), - sys.excepthook, - ( , - , - , ).

+1

Source: https://habr.com/ru/post/1764902/


All Articles