A lightweight, plug-and-play logger.py
you can copy into any Python project.
It supports colorized terminal output, rotating file logs, and is easy to configure using .env
.
- 🟢 Colored logs in the console
- 📁 File logging with rotation (5MB x 5 backups)
- ⚙️ Configurable via
.env
- ✅ Simple usage:
from logger import get_logger
git clone https://github.com/yourusername/prebuilt-logger.git
cd prebuilt-logger
pip install -r requirements.txt
cp .env.example .env
Edit .env
to set your desired logging level:
LOG_LEVEL=DEBUG
ENV=development
python example.py
from logger import get_logger
logger = get_logger(__name__)
logger.info("Logger is working!")
logger.error("Something went wrong!")
All logs are written to logs/app.log
. The directory is auto-created if it doesn't exist.
colorlog
python-dotenv
(Already included in requirements.txt
)