Skip to content

A lightweight, plug-and-play logger for Python projects. Includes colorized terminal logging, rotating file logs, and easy environment-based configuration via .env. Perfect for scripts, CLIs, and microservices.

Notifications You must be signed in to change notification settings

Deffz-Finesse/Prebuilt-Python-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠️ Prebuilt Python Logger

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.

📦 Features

  • 🟢 Colored logs in the console
  • 📁 File logging with rotation (5MB x 5 backups)
  • ⚙️ Configurable via .env
  • ✅ Simple usage: from logger import get_logger

🚀 Quick Start

1. Clone this repo or copy logger.py into your project

git clone https://github.com/yourusername/prebuilt-logger.git
cd prebuilt-logger

2. Install dependencies

pip install -r requirements.txt

3. Set up environment config

cp .env.example .env

Edit .env to set your desired logging level:

LOG_LEVEL=DEBUG
ENV=development

4. Run the example

python example.py

🧪 Usage in Your Code

from logger import get_logger

logger = get_logger(__name__)

logger.info("Logger is working!")
logger.error("Something went wrong!")

📁 Logs

All logs are written to logs/app.log. The directory is auto-created if it doesn't exist.


📜 Requirements

  • colorlog
  • python-dotenv

(Already included in requirements.txt)

About

A lightweight, plug-and-play logger for Python projects. Includes colorized terminal logging, rotating file logs, and easy environment-based configuration via .env. Perfect for scripts, CLIs, and microservices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages