A simple logger for python
Project description
Simple Python logger
A simple logger for console/file logging with duplicate logs filter support
Release new version
requirements
- Export GitHub token
export GITHUB_TOKEN=<your_github_token>
Run the following once (execute outside repository dir for example ~/
):
sudo npm install --global release-it
npm install --save-dev @release-it/bumper
usage
- Create a release
git pull
release-it # Follow the instructions
Usage
from simple_logger.logger import get_logger
logger = get_logger(name=__name__, level=logging.DEBUG, filename="my-log.log")
logger.info("This is INFO log")
logger.success("This is SUCCESS log")
TOKEN = "1234"
PASS = "pass123"
logger.hash(f"This is my password: {PASS} and this is my token {TOKEN}", hash=[PASS, TOKEN])
>>> This is INFO log
>>> This is SUCCESS log
>>> This is my password: ***** and this is my token *****
# mask sensitive data default words are ["password", "token", "apikey", "secret"]
# Pass mask_sensitive_patterns = ["custom_pattern", "another_pattern"] to change the default patterns to match
hashed_logger = get_logger(name=__name__, mask_sensitive=True)
hashed_logger.info(er = get"This is my password: pass123")
hashed_logger.info(er = get"This is my token tok456!")
hashed_logger.info(er = get"This is my apikey - api#$789")
hashed_logger.info(er = get"This is my secret -> sec1234abc")
>>> This is my password *****
>>> This is my token *****
>>> This is my apikey *****
>>> This is my secret *****
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
Close
Hashes for python_simple_logger-1.0.25.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec1bf55b2c514fee4d73ec9b0d4ec2701e149adb2b49ace91bd4eb6b9bb3318e |
|
MD5 | 62203e868966b65056ed208c4fed9f93 |
|
BLAKE2b-256 | aa626333914f66b4be48839b1756673e092f6816a9220c8e9cf8cb7e5a90166f |