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 pytime-logger
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 run_examples.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.4.tar.gz
(12.2 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.4.tar.gz.
File metadata
- Download URL: pytime-logger-0.0.4.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c389b4ecfab20f572e58ba8d213bd601f026909e055e24a9957368a69e99718
|
|
| MD5 |
0f2e38245cfda3df069c8623cb6ff093
|
|
| BLAKE2b-256 |
d28ca9cc0abd0000f9ea9eee38e553bbbaed12a4faef32d1258d72ed03019b2c
|
File details
Details for the file pytime_logger-0.0.4-py3-none-any.whl.
File metadata
- Download URL: pytime_logger-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2030ca8af2ed8534a1ff4ecbf95034c132704228e7fbf7b20b112a18f8775c70
|
|
| MD5 |
bafc7a933d6411e8800294c9bac4857d
|
|
| BLAKE2b-256 |
4ee625f5cf3f586bbd37bb08aca68e99e38112420089e52cff2fe59b6c4f190a
|