Skip to main content

TimeGuardian is a package for execution time measurement

Project description

TimeGuardian

TimeGuardian is a Python package designed for measuring and logging the execution time of functions. This package is especially useful for performance monitoring and optimization in Python applications.

Features

  • Easy-to-use decorators for timing functions.
  • Integrated logging with rich formatting.
  • Conditional logging based on execution time.

Installation

You can install TimeGuardian directly from pip:

pip install timeguardian

Alternatively, if you have downloaded the source code, you can install it using:

cd path/to/TimeGuardian
pip install timeguardian

Usage

Import TimeGuardian from the timeguardian package and use it as a decorator on your functions to measure their execution time.

Basic Usage

from timeguardian import TimeGuardian

@TimeGuardian.measure
def my_function():
    # function implementation

Terminal output:
Alt text

Advanced Usage

You can also provide a custom name for logging the execution time:

from timeguardian import TimeGuardian

@TimeGuardian.measure(name="CustomFunctionName")
def another_function():
    # function implementation

Additionally, you can set a time limit for logging. Execution times will only be logged if they exceed this limit:

from timeguardian import TimeGuardian

@TimeGuardian.measure(logTimeLimit=200)
def limited_function():
    # function implementation

Terminal output:
Alt text

Contributing

Contributions to TimeGuardian are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

timeguardian-0.0.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

timeguardian-0.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file timeguardian-0.0.2.tar.gz.

File metadata

  • Download URL: timeguardian-0.0.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for timeguardian-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7c72f4aa4e0d454614a488c0a67766885b57baa8625b22a6257fbaa0938ecc92
MD5 7796de57cf771f69b9716d65b0098f67
BLAKE2b-256 45b6c59ff1372e5a3bc02e942c0438bd0cc7c20249eb8c057d5b308bf03a0c23

See more details on using hashes here.

File details

Details for the file timeguardian-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for timeguardian-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 82cbdb5c84fd80e52690393a5c335b143cd260ca18fb9fed4dcd06e8fe463b3b
MD5 8062db75f0efe26e5e3655f6f1dd4d2b
BLAKE2b-256 229b278777cecadd0e39caa1f0790733426d7e05b452e80a7e9c761192aaa98b

See more details on using hashes here.

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