python_log_sanitizer
Python log sanitizer
Instalation
Pipenv
pipenv install python_log_sanitizer
Pip
pip install python_log_sanitizer
Usage
To run this example please install python-json-logger:
pip install python-json-logger
LOG_CONFIG = {
"version": 1,
"formatters": {
"json": {
"class": "pythonjsonlogger.jsonlogger.JsonFormatter",
"format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s"
}
},
"filters": {
"sanitizer": {
"()" : "python_log_sanitizer.SanitizerFilter",
"patterns": ["extra"],
"placeholder": "*"
}
},
"handlers": {
"json": {
"class": "logging.StreamHandler",
"formatter": "json"
}
},
"loggers": {
"root": {
"level": "INFO",
"handlers": ["json"],
"filters": ["sanitizer"]
}
}
}
import logging
from logging import config
config.dictConfig(LOG_CONFIG) # load log config from dict
logger = logging.getLogger("root") # get root logger instance
logger.info("farofa", extra={"extra": "farofa"}) # log message with extra arguments
Example output:
{"asctime": "2018-11-04 23:01:55,804", "levelname": "INFO", "module": "<ipython-input-8-f8c68848bfbe>", "message": "farofa", "extra": "*"}
Metadata
Release files for python-log-sanitizer 0.0.3
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 |
|---|---|---|---|---|
| python_log_sanitizer-0.0.3.tar.gz | 3.3 kB | Without provenance | Details for python_log_sanitizer-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_log_sanitizer-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for python_log_sanitizer-0.0.3-py3-none-any.whl |
Total release size: 7.9 kB
Release files / python_log_sanitizer-0.0.3.tar.gz
| Download URL | python_log_sanitizer-0.0.3.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0232597970e6bb19a765be7e1914d134e86031d80b0699fa6bca773e103728bf
|
|
BLAKE2b-256 checksum How to use checksums |
10506dcdf27ecbfe62b1efae620951e85812810c0d693b309e7802dd0d2307ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Release files / python_log_sanitizer-0.0.3-py3-none-any.whl
| Download URL | python_log_sanitizer-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaea65a0524af8f0ac7e3b6f4f5537e07a7db2f3754d526ed5f131883ea9502d
|
|
BLAKE2b-256 checksum How to use checksums |
b1c3954cb0da812b2ffaba2bff3917f05876ee58ae4768d0ae4a9c328daa5bf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Security for python-log-sanitizer 0.0.3
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.