Registry / observability / logfury

logfury

JSON →
library1.0.1pypypi✓ verified 85d ago

Logfury is a toolkit for Python library maintainers, offering responsible, low-boilerplate logging of method calls. It implements an 'apiver' import strategy (e.g., `from logfury.v1 import ...`) to ensure API stability, allowing users to explicitly opt into versioned APIs. The library is currently at version 1.0.1, released on October 23, 2021, with a focus on method call tracing and a mature development status.

pip install logfury
INSTALL
IMPORT
SIG · LOGFURY
L
logfury
observabilitypythonv1.0.1
Install
1.7s avg
Import
43ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.044s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.043s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DefaultTraceMeta
from logfury.v1 import DefaultTraceMeta
from logfury import DefaultTraceMeta
Logfury uses an 'apiver' strategy; always import from a specific version module (e.g., `v1`) to ensure API stability and avoid breaking changes from a top-level import.
limit_trace_arguments
from logfury.v1 import limit_trace_arguments
Part of the versioned API.
disable_trace
from logfury.v1 import disable_trace
Part of the versioned API.

This example demonstrates basic usage of `logfury` by applying `DefaultTraceMeta` to a class to automatically log method calls. It also shows `disable_trace` for excluding methods and `limit_trace_arguments` for sensitive parameters. Ensure basic logging is configured to see output.

import logging import six from logfury.v1 import DefaultTraceMeta, limit_trace_arguments, disable_trace logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) @six.add_metaclass(DefaultTraceMeta) class Foo: def baz(self, a, b, c=None): return True def get_blah(self): return 5 def _hello(self): pass @disable_trace def world(self): pass def __repr__(self): return '<{} object>'.format(self.__class__.__name__) class Bar(Foo): def baz(self, a, b, c=None): b += 1 return super(Bar, self).baz(a, b, c) @limit_trace_arguments(skip=['password']) def secret(self, password, other): pass a = Foo() a.baz(1, 2, 3) a.baz(4, b=8) a.get_blah() # Not traced by default pattern a._hello() # Not traced by default pattern a.world() # Explicitly disabled b = Bar() b.baz(5, 6) b.secret('my_secret', 'other_value') # Expected output in console for a.baz calls: # DEBUG:__main__:calling Foo.baz(self=<Foo object>, a=1, b=2, c=3) # DEBUG:__main__:calling Foo.baz(self=<Foo object>, a=4, b=8)
Debug
Known issues
deprecatedSupport for Python versions prior to 3.5 was deprecated in v1.0.0. Ensure your environment uses Python 3.5 or newer.
fix
Upgrade to Python 3.5 or a later supported version.
affects: <1.0.0
gotchaLogfury uses an 'apiver' strategy where you explicitly import from `logfury.vX` (e.g., `logfury.v1`). Importing directly from `logfury` (e.g., `from logfury import ...`) is not recommended as it could lead to unexpected behavior or breakage if the default top-level API changes in future versions.
fix
Always use `from logfury.v1 import ...` to explicitly bind to a stable API version.
affects: >=1.0.0
gotchaPrior to version 1.0.1, there were known issues with decorating entire classes and incorrect ordering of arguments in logged output. These were fixed in v1.0.1.
fix
Upgrade to logfury version 1.0.1 or newer to ensure correct class decoration and argument ordering in logs.
affects: <1.0.1
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'logfury'
The 'logfury' package is not installed in the current Python environment.
fix
Install the package using pip: `pip install logfury`
NameError: name 'trace_call' is not defined
The user attempted to use the 'trace_call' decorator without explicitly importing it, possibly by only doing `import logfury` instead of `from logfury import trace_call`.
fix
Ensure 'trace_call' is imported from the 'logfury' package: `from logfury import trace_call` or `from logfury import *`
TypeError: 'str' object is not callable
The 'trace_call' decorator expects a logger instance as its argument, but the user passed an object of an incorrect type, such as a string.
fix
Pass a valid logger instance to 'trace_call', typically obtained from Python's standard logging library, e.g., `import logging; logger = logging.getLogger(__name__); @trace_call(logger)`
ModuleNotFoundError: No module named 'logfury.v1'
Although the library's description mentions an 'apiver' import strategy (e.g., `from logfury.v1 import ...`), the 'v1' submodule may not be directly importable as a top-level module in version 1.0.1 for components like `trace_call`, which are typically imported directly from `logfury`.
fix
Import components like 'trace_call' directly from the 'logfury' package instead: `from logfury import trace_call`
Upgrade
Version history
1.0.1latest on PyPI · released Oct 23, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
2
Resources
logfury — pip install logfury · libregistry