Autologging
Autologging copied to clipboard
Feature request: allow custom format function for args/kwargs in @traced
With the current behavior of @traced, the log message produced when entering or exiting a traced function uses the format specifier %r to print the args/kwargs inputs to the function and the return value of the function. It would be nice if we could provide our own custom formatter function to use when displaying these values, e.g. pprint.pformat for large dicts, lambda x: json.dumps(json.loads(x), indent=2) for long single-line JSON strings, etc.
Can't you achieve this with customizing logging.Formatter? (Examples in my own repo extendedlogging.)