-
Notifications
You must be signed in to change notification settings - Fork 766
Description
Hi,
when logging with loguru, messages are truncated by default after 128 symbols, see:
loguru/loguru/_better_exceptions.py
Line 346 in 633016d
| v = v[: max_length - 3] + "..." |
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!