You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This hacky approach relies on internal implementation details.
It would be great to have an officially supported way to set the maximum message length via the public API, such as a configuration parameter when adding a handler or as part of the logger.add() method. Or does this somehow already exist?
For example: logger.add(sys.stdout, format="{message}", max_message_length=200)
Thanks!
The text was updated successfully, but these errors were encountered:
I feel that implementing a new max_message_length argument makes the logger.add() method increasingly complex for little gain.
However, I also think that Loguru could benefit from being more easily configurable when it comes to exception formatting. I'm probably planning to change the API so that, for example, you can configure the max length if desired.
For example:
Hi,
when logging with loguru, messages are truncated by default after 128 symbols, see:
loguru/loguru/_better_exceptions.py
Line 346 in 633016d
While using e.g.
@logger.catch(reraise=True)
often relevant information is truncated.Currently, the only way I found to adjust the maximum message length in loguru requires modifying internal attributes, e.g.:
logger._core.handlers[0]._exception_formatter._max_length = 200
This hacky approach relies on internal implementation details.
It would be great to have an officially supported way to set the maximum message length via the public API, such as a configuration parameter when adding a handler or as part of the logger.add() method. Or does this somehow already exist?
For example:
logger.add(sys.stdout, format="{message}", max_message_length=200)
Thanks!
The text was updated successfully, but these errors were encountered: