Skip to main content

Autologging makes logging and tracing Python classes easy.

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 by passing it to the decorator (i.e. logged(my_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, an autologging.TRACE (level 1) custom log level is registered with the Python logging module so that tracing messages can be toggled on/off independently of DEBUG-level logging.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

Autologging-0.4.0.zip (180.3 kB view hashes)

Uploaded Source

Autologging-0.4.0.tar.gz (139.5 kB view hashes)

Uploaded Source

Built Distributions

Autologging-0.4.0-py3.4.egg (20.6 kB view hashes)

Uploaded Source

Autologging-0.4.0-py3.3.egg (20.8 kB view hashes)

Uploaded Source

Autologging-0.4.0-py3.2.egg (20.5 kB view hashes)

Uploaded Source

Autologging-0.4.0-py2.py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 2 Python 3

Autologging-0.4.0-py2.7.egg (20.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page