AtLog
A simple logging decorator for functions and coroutines.
Installation
pip install atlog
Usage
It is recommended to create a file-level binding to log_func which you then use on the objects you wish to log:
import logging
from atlog import log_func
logging.basicConfig(filename="example.log", level=logging.DEBUG)
logger = logging.getLogger()
log = log_func(logger)
@log
def hello(name):
return f"Hello, {name}."
class Greeter:
@log
def __init__(self, name):
self.greeting = f"Hello, {name}."
@log
def greet(self):
print(self.greeting)
if __name__ == "__main__":
print(hello("John"))
Greeter("John").greet()
This will produce the following example.log:
DEBUG:root:Calling hello(name)
DEBUG:root:hello is defined in path/to/example.py on line 8
DEBUG:root:Arguments: 'John'
DEBUG:root:hello returned 'Hello, John.'
DEBUG:root:Calling __init__(self, name)
DEBUG:root:__init__ is defined in path/to/example.py on line 14
DEBUG:root:Arguments: <__main__.Greeter object at 0x000001E95F84FDF0>, 'John'
DEBUG:root:__init__ returned None
DEBUG:root:Calling greet(self)
DEBUG:root:greet is defined in path/to/example.py on line 18
DEBUG:root:Arguments: <__main__.Greeter object at 0x000001E95F84FDF0>
DEBUG:root:greet returned None
Metadata
Release files for AtLog 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| AtLog-1.0.0.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AtLog-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / AtLog-1.0.0.tar.gz
| Download URL | AtLog-1.0.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cd4eeaf57147ba870a000fcd77fb3b6c1a2fe65e2eb609f59c0b99a86152281
|
|
BLAKE2b-256 checksum How to use checksums |
a3c9728f5669ce3d1cf5df39023565ee49074afec170947c01f38686b9855a33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Release files / AtLog-1.0.0-py3-none-any.whl
| Download URL | AtLog-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2207fc4859e7a82005d9e358a59710164bd9d610eaf20a7f2fce949362908088
|
|
BLAKE2b-256 checksum How to use checksums |
a3945e459b01a329fadc4f02c0253097378034845e1881ed70d2726c403b53bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
|
Security for AtLog 1.0.0
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.