Tracer util allowing masking of arguments in the log
Project description
LogTracer
Log utility allowing detailed tracing of function execution while at the same time masking arguments by name
Description
LogTracer provides a decorator method, enabling detailed output of function execution to facilitate tracing, while at the same time allowing masking of arguments by argument name. The trace method will mask the value of arguments with a name matching any of the string arguments provided to the method.
Example implementation:
import logging
from logtracer import LogTracer
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log = logging.getLogger(__name__)
lt = LogTracer(log)
@lt.trace("password", "pw")
def login(user, pw, username=None, password=None):
pass
login("Arnold", "MyS3cr3tP4ssw0rd!#", username="pony", password="aqew")
The above example produces a log like the below:
1970-01-01 12:34:56,789 - __main__ - DEBUG - Executing function login with args=['Arnold', '**********'] and kwargs={'username': 'pony', 'password': '**********'}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file LogTracer-0.1.0.tar.gz.
File metadata
- Download URL: LogTracer-0.1.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44293bba72969e3b6e26cea300afebf63434800ff360a77823365640fcc3278e
|
|
| MD5 |
23e791cdf9c36aa8cbb4a2ea8f8f8759
|
|
| BLAKE2b-256 |
6e8910eda2eb628b5fffe0e0df8cea742d069cffa5bb938aa8104a01567e1a5a
|
File details
Details for the file LogTracer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: LogTracer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3f7e720d09cb24077e4f67f71c1b62dab42b011f18884f42e9ab4e7969f8af
|
|
| MD5 |
1cd4773d6d11dd87a1c0ce0bfa7060ad
|
|
| BLAKE2b-256 |
af5e13893bfb84392b7194b217ad5968dbd4189daf8552afed6e18ef27a06d92
|