| 106 | |
| 107 | |
| 108 | def test_caught_exception_queue_get(writer, capsys): |
| 109 | logger.add(writer, enqueue=True, catch=True, format="{message}") |
| 110 | |
| 111 | logger.info("It's fine") |
| 112 | logger.bind(broken=NotUnpicklable()).info("Bye bye...") |
| 113 | logger.info("It's fine again") |
| 114 | logger.remove() |
| 115 | |
| 116 | out, err = capsys.readouterr() |
| 117 | lines = err.strip().splitlines() |
| 118 | assert writer.read() == "It's fine\nIt's fine again\n" |
| 119 | assert out == "" |
| 120 | assert lines[0] == "--- Logging error in Loguru Handler #0 ---" |
| 121 | assert lines[1] == "Record was: None" |
| 122 | assert "UnpicklingError: You shall not de-serialize me!" in err |
| 123 | assert lines[-1] == "--- End of logging error ---" |
| 124 | |
| 125 | |
| 126 | def test_caught_exception_sink_write(capsys): |