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
LogTracer-0.1.0.tar.gz
(14.6 kB
view hashes)
Built Distribution
LogTracer-0.1.0-py3-none-any.whl
(15.1 kB
view hashes)
Close
Hashes for LogTracer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b3f7e720d09cb24077e4f67f71c1b62dab42b011f18884f42e9ab4e7969f8af |
|
MD5 | 1cd4773d6d11dd87a1c0ce0bfa7060ad |
|
BLAKE2b-256 | af5e13893bfb84392b7194b217ad5968dbd4189daf8552afed6e18ef27a06d92 |