Skip to main content

Logger for Python functions which automatically captures input arguments and the return value, plus marked intermediate variables, with minimal boilerplate.

Project description

Decorator Logger

The problem

  • Existing logging libraries are geared towards logging for long-running services

  • Sometimes we write code to execute a routine, more like a script. This library aims to be a convenient logger for these functions with minimal boilerplate.

  • We often repeat the same analysis routine for many datasets.

  • Often we require not only the final output of the routine, but wish to log intermediate values.

  • If we compare two results, we need to know whether the analysis code was the same or different. (Most obvious way to do this is to compare code version, however it is not always this simple.)

  • Logging should be easy and not require the user to have to figure out correct paths to store results.

The solution

  • Decorate the 'main' function which is the top level entry point to the analysis routine.
  • All settings should be managed in the arguments supplied to the function, which allows them to be captured by the decorator.
  • Logging is still achieved simply with the log function, which will ascend the call stack until it reaches the __call__ method of the Logger at which point the Logger will handle the logged variable.

Project details


Download files

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

Source Distribution

declog-0.1.0.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

declog-0.1.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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