This project provides a simple way to profile the execution time of your Python functions.
Project description
Time Logger
This project provides a simple way to profile the execution time of your Python functions.
Features
- Measure the execution time of functions with the
@profilingdecorator. - Optionally log the start and end times of function execution.
- Log specific variables or all arguments passed to the function.
- Choose between using the standard
printfunction or a custom logger for output.
Installation
pip install -e .
Usage
from time_logger import profiling
# Basic usage
@profiling()
def my_function():
# Your code here
# Log start and end times
@profiling(log_start=True)
def my_function():
# Your code here
# Log specific variables
@profiling(log_variables=['my_variable'])
def my_function(my_variable):
# Your code here
# Log all arguments
@profiling(log_all_args=True)
def my_function(arg1, arg2):
# Your code here
# Use a custom logger
import logging
logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
logger.addHandler(handler)
@profiling(logger=logger)
def my_function():
# Your code here
Examples
See the tests/test_profiling.py file for more examples.
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
pytime_logger-0.0.2.tar.gz
(13.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytime_logger-0.0.2.tar.gz.
File metadata
- Download URL: pytime_logger-0.0.2.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c8ecf82f71b679a85b50ee1feaa13e1ab9b9f271526c2ea587c4b2e03f7033c
|
|
| MD5 |
a92bc074b547a21222f340f6c8cd075b
|
|
| BLAKE2b-256 |
00c5ec7cd4e4324e2bc6d720e66d2fabc96b1bf79b09dbd02ab72952b22660ab
|
File details
Details for the file pytime_logger-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pytime_logger-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b1398e047d3fc04fb1057ae27d22747373a6ce93c344d7ccaf7ff3fa7a77ddc
|
|
| MD5 |
1dc70cd5ac91afd5da5569fc16af9267
|
|
| BLAKE2b-256 |
1907f71bf2fc038dd76c43dcb38acb8b9413ee1ece85386b34777d32d5136ce3
|