Autologging icon indicating copy to clipboard operation
Autologging copied to clipboard

Feature request: allow custom format function for args/kwargs in @traced

Open kini opened this issue 4 years ago • 1 comments

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.

kini avatar Sep 13 '21 05:09 kini

Can't you achieve this with customizing logging.Formatter? (Examples in my own repo extendedlogging.)

janfeitsma avatar May 15 '22 18:05 janfeitsma