Autologging is a module containing decorators and a metaclass used to make logging classes easier.
Project description
Autologging provides two decorators and a metaclass factory:
- @logged
Decorate a class (or function) to create a __logger member. The logger is automatically named to match the dotted-name of the class or module. Alternatively, provide a specific logger using @logged(logger).
- @traced
Decorate a module-level function to provide call/return tracing. The log record attributes pathname, filename, lineno, module, and funcName work as expected (i.e. they refer to the original function, NOT the proxy function returned by the decorator).
- TracedMethods
Create a metaclass that adds automatic tracing to specified class methods (just like @traced does for module-level functions). The log record attributes pathname, filename, lineno, module, and funcName work as expected (i.e. they refer to the original class method, NOT the proxy method installed by the metaclass).
Additionally, the autologging module defines and registers a custom log level named “TRACE” (level 1) so that tracing messages can be toggled on/off independently of DEBUG-level logging.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.