Beautilog is a Python logging library for beautiful, color-coded terminal output with support for custom log levels, log rotation, and simple configuration through a JSON file.
Install from PyPI:
pip install beautilogOr, for development:
git clone https://github.com/yourname/beautilog.git
cd beautilog
pip install -e .python -c 'from beautilog import logger; logger.info("Hello from Beautilog!")'Beautilog looks for a beautilog.ini file in your working directory or library path. Example config:
[logger]
name = root
save_to_file = true
log_level = INFO
suppress_other_loggers = true
disabled_loggers = []
; disabled_loggers = ["numpy","matplotlib","urllib3"]
[file_logger]
log_file_path = beauti-run.log
backup_count = 5
max_bytes = 104857600
log_level = DEBUG
[custom_levels]
NOTIFICATION = 12
; [redirected_loggers]
; numpy = DEBUG
[level_colors]
CRITICAL = RED
ERROR = BRIGHT_RED
WARNING = YELLOW
INFO = CYAN
NOTIFICATION = GREEN
DEFAULT = RESET| Key | Description |
|---|---|
save_to_file |
Enable/disable file logging |
file_logger |
File logging settings (path, size, backups) |
log_level |
Default log level (DEBUG, INFO, etc.) |
custom_levels |
Define your own log levels like NOTIFICATION |
level_colors |
Customize terminal colors per level |
suppress_other_loggers |
Hide noisy loggers like asyncio, urllib3, etc. |
disabled_loggers |
Specific loggers to be diabled |
from beautilog import logger
logger.info("This is an info message.")
logger.warning("This is a warning!")
logger.error("This is an error!")
# Custom level
logger.notification(f"Custom NOTIFICATION level {logger.NOTIFICATION} message")✅ Custom levels are automatically injected and styled from your config.
Use any of these in level_colors:
- Basic:
RED,GREEN,YELLOW,BLUE,MAGENTA,CYAN,WHITE - Bright:
BRIGHT_RED,BRIGHT_YELLOW, etc. - Control:
RESET(returns to default terminal color)
If "save_to_file": true, logs are saved to beauti-run.log using a rotating file handler.
To deploy this to pypi use the following commands (only for maintainers)
python -m build
twine upload dist/*--
Licensed under the Apache License 2.0 — free for personal and commercial use.
