Even logs from already bound loggers are captured and their processors restored on exit.
(self)
| 92 | assert orig_procs is self.get_active_procs() |
| 93 | |
| 94 | def test_captures_bound_logers(self): |
| 95 | """ |
| 96 | Even logs from already bound loggers are captured and their processors |
| 97 | restored on exit. |
| 98 | """ |
| 99 | logger = get_logger("bound").bind(foo="bar") |
| 100 | logger.info("ensure logger is bound") |
| 101 | |
| 102 | with testing.capture_logs() as logs: |
| 103 | logger.info("hello", answer=42) |
| 104 | |
| 105 | assert logs == [ |
| 106 | { |
| 107 | "event": "hello", |
| 108 | "answer": 42, |
| 109 | "foo": "bar", |
| 110 | "log_level": "info", |
| 111 | } |
| 112 | ] |
| 113 | |
| 114 | def test_captures_log_level_mapping(self): |
| 115 | """ |
nothing calls this directly
no test coverage detected