MCPcopy Create free account
hub / github.com/hynek/structlog / test_use_get_message_false

Method test_use_get_message_false

tests/test_stdlib.py:1497–1523  ·  view source on GitHub ↗

If use_get_message_is False, the event is obtained using str(record.msg) instead of calling record.getMessage. That means positional formatting is not performed.

(self)

Source from the content-addressed store, hash-verified

1495 assert not records
1496
1497 def test_use_get_message_false(self):
1498 """
1499 If use_get_message_is False, the event is obtained using
1500 str(record.msg) instead of calling record.getMessage. That means
1501 positional formatting is not performed.
1502 """
1503 event_dicts = []
1504
1505 def capture(_, __, ed):
1506 event_dicts.append(ed.copy())
1507
1508 return str(ed)
1509
1510 proc = ProcessorFormatter(processors=[capture], use_get_message=False)
1511
1512 record = logging.LogRecord(
1513 "foo",
1514 logging.INFO,
1515 "path.py",
1516 42,
1517 "le msg: %s",
1518 ("keep separate",),
1519 None,
1520 )
1521
1522 assert proc.format(record)
1523 assert "le msg: %s" == event_dicts[0]["event"]
1524
1525
1526@pytest_asyncio.fixture(name="abl")

Callers

nothing calls this directly

Calls 2

formatMethod · 0.95
ProcessorFormatterClass · 0.90

Tested by

no test coverage detected