On this page
  1. logging.LogRecord
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

logging.LogRecord

Prev: logging.LoggerAdapter | Up: logging | Next: logging.makeLogRecord
Rel: logging.addLevelName, logging.basicConfig, logging.BufferingFormatter, logging.captureWarnings
Ref: docs.python.org — logging.LogRecord
Tags: #public #python3 #stdlib #logging


Import

import logging
from logging import LogRecord

Signature & Overview

logging.LogRecord(name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)

A LogRecord instance represents an event being logged.

Methods & Attributes

Usage

import logging

rec = logging.LogRecord("app", logging.ERROR, "main.py", 42, "failed: %s", ("timeout",), None)
assert rec.getMessage() == "failed: timeout" and rec.levelname == "ERROR"

Gotchas

REPL Inspect

from logging import LogRecord
help(LogRecord)

Linked from

Related notes