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 function(a: int, b: 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. |
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.4.0.tar.gz
(4.9 kB
view hashes)
Built Distribution
spoor-0.4.0-py3-none-any.whl
(5.4 kB
view hashes)