(writer)
| 91 | |
| 92 | |
| 93 | def test_exception_class(writer): |
| 94 | logger.add(writer, format="{message}") |
| 95 | |
| 96 | try: |
| 97 | 1 / 0 # noqa: B018 |
| 98 | except Exception: |
| 99 | _, exc_class, _ = sys.exc_info() |
| 100 | |
| 101 | logger.opt(exception=exc_class).debug("test") |
| 102 | |
| 103 | lines = writer.read().strip().splitlines() |
| 104 | |
| 105 | assert lines[0] == "test" |
| 106 | assert lines[-1] == "ZeroDivisionError: division by zero" |
| 107 | |
| 108 | |
| 109 | def test_exception_log_function(writer): |