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.1.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.1.tar.gz.
File metadata
- Download URL: pytime_logger-0.0.1.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 |
1ea6171f403bf44870ba6ca9aac670f90b5dc846cd441ec5e0cac0030ccd0184
|
|
| MD5 |
5fb542bbcdca158732a6c59703a4e39a
|
|
| BLAKE2b-256 |
0311b0a8e209b9a115d7e4e5483abf5657cb6b2d51f718e83054f67266e895e4
|
File details
Details for the file pytime_logger-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pytime_logger-0.0.1-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 |
4d7378a8e1dfa8ed5f2efacc8b7e8f5dbc2ece75e9ca46161d83ba9e9c78d8c7
|
|
| MD5 |
64457ab2bb993cdd5bd48eeb67f60410
|
|
| BLAKE2b-256 |
347ce1b8eb697a8837b1827468d50a46fe35fcd23934dc13a744cfb431b65f54
|