all Python 3loggingfunction
logging.disable()
levels
Globally switches off all records at the given level and below in every logger at once, overriding their own levels.
Syntax
logging.disable(level=logging.CRITICAL)
The given level itself is included: disable(logging.INFO) silences both INFO and DEBUG and keeps WARNING. Called with no argument (3.7+) it silences everything up to CRITICAL. The setting never resets by itself — in tests call disable(logging.NOTSET) afterwards, or logging stays silent in the following tests too.
Examples
import logging, sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(message)s')
logging.disable(logging.INFO)
logging.info('не видно')
logging.warning('видно') # → видно
logging.disable(logging.NOTSET) # вернуть как было
logging.info('снова видно') # → снова видно
See also
Open in the full glossarydocs.python.orgReport an inaccuracy