Multiprocessing-Safe Logging Filter for Loguru
The problem description is odd:
When using
enqueue=True, loguru usesmultiprocessing.Queuewhich silently drops logs containing unpicklable objects:Issue #399: C Extension Exceptions
# SWIG/Cython/pybind11 exceptions cannot be pickled try: camera.set_feature(value) except Exception: logger.exception("Camera error") # Silently fails - no log output **Error:** `_pickle.PicklingError: Can't pickle <class '_genapi.InvalidArgumentException'>`Issue #498: Pydantic Models with Thread Locks
# Pydantic v1/v2 models with _thread.RLock cannot be pickled logger.bind(user=pydantic_model).info("User action") # Silently fails **Error:** `_pickle.PicklingError: Can't pickle <class '_thread.RLock'>`The log is silently dropped - no file output, no console output, no error raised.
For one thing, Loguru does not use multiprocessing.Queue, so that initial claim is plain wrong. Secondly, it asserts that logs containing unpicklable objects are silently dropped, yet it links to issues showing that such cases actually produce a _pickle.PicklingError in the program output, which clearly contradicts the claim.
Sorry, I'm not going to delve into the rest of the report given the inaccuracies of these opening assumptions.
If you have noticed that Loguru could be improved, please clarify your description of the problem with a minimal reproducible example.