Skip to main content

ftracer Package

ftracer - decorator functions to trace invocation of functions and class methods

DESCRIPTION

A Python module for tracing function and method invocations with detailed, customizable logging. The ftracer module provides tools for decorating individual functions, all functions in a module, and all methods in a class to log their invocation, arguments, and return values. This is particularly useful for debugging and understanding the flow of execution in your code.

ftracer allows developers to:

  • Decorate individual functions with the @trace decorator to log their calls.
  • Decorate entire classes with the @trace_methods decorator to trace all method calls within a class.
  • Automatically attach decorators to all functions or classes in a module using trace_all_functions and trace_all_classes.
  • Customize the tracing behavior, such as pretty-printing arguments and limiting list representations.

Key features:

  • Customizable pretty-printer for function arguments and return values.
  • Ability to apply tracing globally to all functions or classes in a module.
  • Optional debug mode for additional trace logs.

EXAMPLE

Tracing Individual Functions

from ftracer import trace

@trace
def add(a, b):
    return a + b

result = add(5, 3)
** add(a=5, b=3)

Tracing All Methods in a Class

from ftracer import trace_methods

@trace_methods
class Calculator:
    def multiply(self, x, y):
        return x * y

calc = Calculator()
calc.multiply(4, 7)
** multiply(self=<Calculator>, x=4, y=7)

Applying Traces Globally in a Module

from ftracer import trace_all_functions

trace_all_functions()

def greet(name):
    return f"Hello, {name}!"

greet("Alice")
** greet(name='Alice')

INSTALLATION

pip3 install ftracer

AVAILABILITY

The latest version of ftracer module is available at PyPI (https://pypi.org/project/ftracer/) .

SEE ALSO

AUTHOR

Hiroyuki Ohsaki <code[atmark]lsnl.jp>

Metadata

Release files for ftracer 1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftracer 1.7
File Size Uploaded Provenance
ftracer-1.7.tar.gz 16.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ftracer 1.7
File Interpreter ABI Platform
ftracer-1.7-py3-none-any.whl Python 3 none any Details

Total release size: 32.5 kB

Release files / ftracer-1.7.tar.gz

Download URL ftracer-1.7.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4eade07fce97d30feb09a970df879c347b80d3ec959a8883ce5acfc6c6c71c7c
BLAKE2b-256 checksum
How to use checksums
a396e68054f1e0c174b7456cf321cc3b14fb11db6cbe91337651b487eb803e41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / ftracer-1.7-py3-none-any.whl

Download URL ftracer-1.7-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
923b078450aaeb56a9a19476dc8679cd93eb744cb879944f516108968dd3c060
BLAKE2b-256 checksum
How to use checksums
71d021a6cd6712abf3110ffb5c2b4d8672dfb146813daf8de684921fbb06b2eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for ftracer 1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page