Delgan
Delgan
That's not really feasible, because the `logger` is being used before [the frame](https://docs.python.org/3/reference/datamodel.html#frame-objects) for the wrapped function even exist. They are not part of the same call stack. I'd recommend...
Actually, you should preferably not use `from loguru._logger import Logger`. This is an internal type that is not supposed to be exposed publicly. You'll also miss many of the other...
Thanks for the suggestion @misotrnka. However, as you can see with failing tests, the observed behavior is actually the expected one. See notably #599, #1011, #1054. Using Loguru, levels are...
This is not a bug nor something I can avoid. Loguru needs to import and use the [`token`](https://docs.python.org/3/library/token.html) module which exists in the Python standard libraries. When Python resolves imports,...
This looks like a buffering issue, which I assume is specific to your environment (I'm personally not observing the behavior you described). What about the following snippet? Can you see...
If you want to overwrite the logs from the previous session, you can add your handler with `mode="w"` (similar to `open()` built-in): ```python logger.add("file.log", mode="w") ``` Otherwise, you need to...
This is because `{exception}` is automatically appended to your `format` for convenience. This behavior is disabled when using a function as the formatter. ```python logger.add(custom_handler, format=lambda _: "{message}") ```
Hi @zmeir. This is actually part of the design. Internally, `logger.contextualize()` relies on the [`contextvars`](https://docs.python.org/3/library/contextvars.html) built-in Python library. This offers interesting guarantees regarding thread-safety, in particular that it affects only...
Sorry for taking so long to answer. Thanks for the concrete example. I do agree that Loguru does not have a good answer currently for this use-case. The only clean...
> While exposing the context may be useful in some scenarios, in my case it still won't help because the function in which `logger.contextualize()` is called is usually a few...