Auto-logger
Automatically add function call logs and method call logs for Python code.
Install
pip install -U auto-logger
Use
import logging
from dataclasses import dataclass
from auto_logger import Config, MethodLoggerMeta, logFuncCall,formatJson
logging.basicConfig(level=logging.INFO)
@logFuncCall
def add(a: int, b: int):
return a + b
add(1, 2) # INFO:auto_logger:CALL FUCNTION <add> WITH ARGS (1, 2) KWARGS {} RETURNS 3
add(a=1, b=2) # INFO:auto_logger:CALL FUCNTION <add> WITH ARGS () KWARGS {'a': 1, 'b': 2} RETURNS 3
@dataclass
class A(metaclass=MethodLoggerMeta):
a: int = 0
def add(self, n: int):
self.a += 1
def abs(self):
return abs(self.a)
A().add(1) # INFO:auto_logger:CALL METHOD <add> OF A(a=0) WITH ARGS (1,) KWARGS {} RETURNS None
Config.format = formatJson
A().add(1) # INFO:auto_logger:{"args": [1], "kwargs": {}, "ret": null, "method": "add", "object": "A(a=0)"}
Config.ignoreMethods[A] = {'abs'}
A().abs() # Log nothing
Metadata
Release files for auto-logger 0.1.2
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 | Actions |
|---|---|---|---|---|
| auto-logger-0.1.2.tar.gz | 3.1 kB | Without provenance | Details for auto-logger-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| auto_logger-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for auto_logger-0.1.2-py3-none-any.whl |
Total release size: 6.6 kB
Release files / auto-logger-0.1.2.tar.gz
| Download URL | auto-logger-0.1.2.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6ff525aa78ebbe89e6dea40bbb5e03c12bf0335c6e358e612895c35ff11442d
|
|
BLAKE2b-256 checksum How to use checksums |
ad405849ebb4d87bf5cc910fab3bf96096170e4ec981574280ffaf4d23f0eb22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Linux/5.4.0-1031-azure
|
Release files / auto_logger-0.1.2-py3-none-any.whl
| Download URL | auto_logger-0.1.2-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86a08e72ada1fad4d597789d40592ae7c39d1a5886124cd379d950aa2ee5c670
|
|
BLAKE2b-256 checksum How to use checksums |
506ee2b73e7e8dad2e7867a3570cb1319cbaed55306b6bb2d7ff23915956bc0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Linux/5.4.0-1031-azure
|
Security for auto-logger 0.1.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.