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.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

timeguardian-0.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for timeguardian-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5858f046d646007841d14762637dfb3f3a264c50da9cb86d26a0940af3df0538
MD5 a55b13681296c419683eedf3143476a6
BLAKE2b-256 17970f181e1a33876ce057c747cdc2d16dab714aa680119263f637ff4080c6b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for timeguardian-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11483c3340abd87c6409ae81b67ba4e204582734ad03173fc1252a45d41b6e70
MD5 af43bf0b06db83c224cd7ebbaa9c6a07
BLAKE2b-256 573dad5ee62166275da865bc31aa653940c595576d15d11bf6f05cbb9850ea9b

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