Python Glossary Русский

all Python 3loggingfunction

logging.fatal()

levels

An old name for logging.critical(): it logs a message at level CRITICAL on the root logger. New code uses critical().

Syntax

logging.fatal(msg, *args, **kwargs)

The function is not in the documentation, and its docstring asks you to call critical() instead; calling it raises no warning though. The record's level is named CRITICAL, not FATAL: FATAL is merely a second name for 50 in getLevelNamesMapping(). Despite the name, it does not stop the program.

Examples

import logging, sys
logging.basicConfig(stream=sys.stdout, format='%(levelname)s %(message)s')
logging.fatal('конец')  # → CRITICAL конец
print(logging.FATAL == logging.CRITICAL)  # → True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy