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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.044s · 17.9MB
glibcpy 3.10–3.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)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'logfury'
The 'logfury' package is not installed in the current Python environment.
fixInstall 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`.
fixEnsure '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.
fixPass 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`.
fixImport 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.