aspectlib.debug¶
aspectlib.debug.log | Decorates func to have logging. |
aspectlib.debug.format_stack | Returns a one-line string with the current callstack. |
aspectlib.debug.frame_iterator | Yields frames till there are no more. |
aspectlib.debug.strip_non_ascii | Convert to string (using str) and replace non-ascii characters with a dot (.). |
- aspectlib.debug.format_stack(skip=0, length=6, _sep='/')[source]¶
Returns a one-line string with the current callstack.
- aspectlib.debug.log(func=None, stacktrace=10, stacktrace_align=60, attributes=(), module=True, arguments=True, arguments_repr=<built-in function repr>, result=True, exception=True, exception_repr=<built-in function repr>, result_repr=<function strip_non_ascii at 0x2fa7848>, use_logging='CRITICAL', print_to=None)[source]¶
Decorates func to have logging.
Parameters: - func (function) – Function to decorate. If missing log returns a partial which you can use as a decorator.
- stacktrace (int) – Number of frames to show.
- stacktrace_align (int) – Column to align the framelist to.
- attributes (list) – List of instance attributes to show, in case the function is a instance method.
- module (bool) – Show the module.
- arguments (bool) – If True, then show arguments.
- arguments_repr (bool) – Function to convert one argument to a string.
- result (bool) – If True, then show result.
- exception (bool) – If True, then show exceptions.
- exception_repr (function) – Function to convert an exception to a string.
- result_repr (function) – Function to convert the result object to a string.
- use_logging (string) – Emit log messages with the given loglevel.
- print_to (fileobject) – File object to write to, in case you don’t want to use logging module.
Returns: A decorator or a wrapper.