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)
| 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") |
nothing calls this directly
no test coverage detected