This is powerful logging
Project description
PColorLogging
The powerful python logging, you can create colorful logging and easy to add logging level or record attribute
Getting Start
To create the logger
import logging
from PColorLogging import DEBUG, INFO, ERROR, WARNING, CRITICAL
from PColorLogging.Drawer.color import PColor, TextMode
from PColorLogging.Formatter.colored_formatter import ColoredFormatter
from PColorLogging.Logger.Adapter.extra_adapter_logger import ExtraAdapterLogger
colored_formatter = ColoredFormatter(f"[%(asctime)s] %(levelname)s:%(custom)s %(message)s", [
{"config": {"message": [PColor.BLUE]}, "level": [DEBUG]},
{"config": {"message": [PColor.BLUE], "custom": [PColor.B_WHITE]}, "level": [INFO]},
{"config": {"message": [PColor.CYAN, TextMode.UNDERLINE]}, "level": [ERROR]},
{"config": {"message": [PColor.GREEN, TextMode.SLOW_BLINK]}, "level": [WARNING]},
{"config": {"message": [PColor.WHITE, TextMode.FAST_BLINK]}, "level": [CRITICAL]},
{"config": {"levelname": [PColor.B_CYAN, PColor.WHITE]}, "level": [25]}
])
extra_logger = ExtraAdapterLogger("logger", {"custom": "1111"})
console_handler = logging.StreamHandler()
console_handler.setFormatter(colored_formatter)
extra_logger.add_handler(console_handler)
extra_logger.setLevel(logging.INFO)
extra_logger.debug("this is debug", extra={"custom": 4321})
extra_logger.info("this is info")
extra_logger.warning("this is warning")
extra_logger.error("this is error")
extra_logger.critical("this is critical")
extra_logger.log(25, "this is custom logging level")
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
PColorLogging-0.0.22.tar.gz
(6.6 kB
view details)
Built Distribution
File details
Details for the file PColorLogging-0.0.22.tar.gz
.
File metadata
- Download URL: PColorLogging-0.0.22.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41863158adccc49fead6b69702a5e6fed7aa90b2a181cad21ba4d9a67dd38bab |
|
MD5 | 39aaba5c8b3e06794dd51e5d1e09a39b |
|
BLAKE2b-256 | ef8e0f9161fcee4efe121843df30297e350fa7108480e83c5c967063f7ab9b91 |
File details
Details for the file PColorLogging-0.0.22-py3-none-any.whl
.
File metadata
- Download URL: PColorLogging-0.0.22-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bac539201783027cedfc3714c2b3dd43782692090f614449afec9029ab53bdef |
|
MD5 | f1cc6aa0e2ca4b4a16773c74532f60b9 |
|
BLAKE2b-256 | 16d5125810d9afd4179f39a2f5a5e10d6a6f5842a416ae2f06f761c53f8eb6ae |