Track functions invocations
Project description
spoor
Track invocation of your functions and methods; display collected statistics for the invocations; export data gathered to external services.
$ pip install spoor
Usage
from spoor import Spoor
s = Spoor()
@s.track
def func(a: int, b: int) -> int:
return a + b
func(5, 10)
func(23, 42)
assert s.called(func)
assert s.call_count(func) == 2
Configuration
Option | Type | Default | Description |
---|---|---|---|
attach |
bool |
False |
Expose called /call_count attributes directly on a function/method object. |
distinct_instances |
bool |
False |
Separate metrics collection for each instance of a class. Has no effect if tracking only functions. |
skip_dunder |
bool |
True |
Do not track double underscore method calls (like __str__ ) for class instances. Has no effect if tracking only functions. |
disabled |
bool |
False |
Initialize as inactive and ignore metrics collection until enabled explicitly. Can be controlled via enable() /disable() methods later. |
Exporters
See also
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
spoor-0.6.0.tar.gz
(7.3 kB
view hashes)
Built Distribution
spoor-0.6.0-py3-none-any.whl
(7.5 kB
view hashes)