Python library for tracing function calls and performance
Project description
_____ __
_/ ____\_ __ ____ _____/ |_____________ ____ ____
\ __\ | \/ \_/ ___\ __\_ __ \__ \ _/ ___\/ __ \
| | | | / | \ \___| | | | \// __ \\ \__\ ___/
|__| |____/|___| /\___ >__| |__| (____ /\___ >___ >
\/ \/ \/ \/ \/
functrace is a Python library for detailed function call tracing. It provides logging and performance tracking to help monitor execution, measure timing, and debug effectively.
Getting Started
To begin using functrace, you'll first need to install it. This can be easily done using pip.
Simply run the following command to install the package:
pip install functrace
Quick Start
Get up and running with functrace quickly by following this simple example.
Below is a basic usage scenario to help you integrate functrace into your project and start tracing function calls.
from functrace import TraceResult, trace
def trace_callback(result: TraceResult) -> None:
function_call = result.function_call.format()
elapsed_time = result.elapsed_time.format()
returned_value = repr(result.returned_value)
exception = repr(result.exception)
parts = [function_call]
if result.is_started:
parts.extend(['Started'])
if result.is_completed:
parts.extend(['Completed', elapsed_time, returned_value])
if result.is_failed:
parts.extend(['Failed', elapsed_time, exception])
message = ' | '.join(parts)
print(message)
@trace(callback=trace_callback)
def func(a, b, c):
return a, b, c
if __name__ == '__main__':
func(1, 2, 3)
# func(a=1, b=2, c=3) | Started
# func(a=1, b=2, c=3) | Completed | 1.25 microseconds | (1, 2, 3)
Summary
You can find functrace on PyPI for installation and package details. For comprehensive documentation and usage guides, visit Read the Docs. For source code and contributions, check out the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 functrace-0.0.5.tar.gz.
File metadata
- Download URL: functrace-0.0.5.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d80efdc4ff3414172c101927aadfe4e25140ad7750bcfa9b0d05f47815e27c
|
|
| MD5 |
8820992cf814bfe0ec400f0dbd16cab4
|
|
| BLAKE2b-256 |
150f3698f588cd65e6c2dca92bcffc1d08e595cf8fd65adb3711489015f06eb7
|
File details
Details for the file functrace-0.0.5-py3-none-any.whl.
File metadata
- Download URL: functrace-0.0.5-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9038dd34165b9c48ec251c13484aa88fb83eef74c43329ee6cab9abb0989f832
|
|
| MD5 |
f1c78c4301eb43292e5ac63fae60840f
|
|
| BLAKE2b-256 |
7d193db3b1ae12b5b53ec895d91908c25b723011da181ce94000224617dc0358
|