Python Glossary Русский

Python 3.2+loggingfunction

logging.getLogRecordFactory()

records and filters

Returns the current log record factory — the callable loggers use to create a LogRecord.

Syntax

old_factory = logging.getLogRecordFactory()

You call it for one reason: to keep the old factory before setLogRecordFactory() and call it from the new one. Building the record by calling LogRecord directly bypasses any factory installed by someone else, such as a library, and its attributes go missing. By default it returns the LogRecord class itself.

Examples

import logging
print(logging.getLogRecordFactory() is logging.LogRecord)  # → True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy