exceptions and warn log levels are mapped like in regular loggers.
(self)
| 112 | ] |
| 113 | |
| 114 | def test_captures_log_level_mapping(self): |
| 115 | """ |
| 116 | exceptions and warn log levels are mapped like in regular loggers. |
| 117 | """ |
| 118 | structlog.configure( |
| 119 | processors=[ |
| 120 | structlog.stdlib.ProcessorFormatter.wrap_for_formatter, |
| 121 | ], |
| 122 | logger_factory=structlog.stdlib.LoggerFactory(), |
| 123 | wrapper_class=structlog.stdlib.BoundLogger, |
| 124 | ) |
| 125 | with testing.capture_logs() as logs: |
| 126 | get_logger().exception("hello", answer=42) |
| 127 | get_logger().warn("again", answer=23) |
| 128 | |
| 129 | assert [ |
| 130 | { |
| 131 | "event": "hello", |
| 132 | "answer": 42, |
| 133 | "exc_info": True, |
| 134 | "log_level": "error", |
| 135 | }, |
| 136 | { |
| 137 | "answer": 23, |
| 138 | "event": "again", |
| 139 | "log_level": "warning", |
| 140 | }, |
| 141 | ] == logs |
| 142 | |
| 143 | |
| 144 | class TestReturnLogger: |
nothing calls this directly
no test coverage detected