Table of Contents
Overview
This project is a custom logging module built from scratch in Python using Procedural programming.
It provides a structured, extensible, and lightweight way to capture, format, and store log messages across multiple output formats (console, file, and database).
Features
Key highlights of ESTROSEC’s Python Logger:
- Multi-Type Logging — TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, FATAL
- Multi-Level Logging — ALL, HIGH, MEDIUM, LOW
- Multi-Output Logging — Console, File, SQLite Database
- Named Loggers — Create multiple loggers with custom names/categories
-
Configurable File Logging — Choose custom file paths for
.log
files - Toggleable Outputs — Enable/disable console, file, or DB logging dynamically
- Seamless Procedural Integration — Designed for easy integration into Procedural-based projects
- Lightweight & Reusable — Plug-and-play across Python projects
Showcase
Console Logging
- Clean, modern formatting with coloured output
- Format: [LoggerName] [Timestamp] [Level] Message
File Logging
- Same format as console logging (no colours)
- Stored in
.log
files for persistence
Database Logging (SQLite3)
- Logs stored in a structured SQLite database
- Data separated into columns for easy querying & analysis
- Current limitation: DB file stored in a fixed location (configurable in future roadmap)
Getting Started
1. Download the Code
Download the latest release to get the logger.py
module.
2. Add to Your Project
Place the logger.py
file in your project directory:
Your-Project/
├─ main.py
└─ logger.py
3. Import the Logger
import logger
Usage
Create a Logger
log = logger.create_logger("MyLogger")
Initialize the Logger
logger.initialize_logger(log, True, True)
Console Logging
logger.fatal(log, "Testing Fatal Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
logger.error(log, "Testing Error Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
logger.warning(log, "Testing Warning Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
logger.success(log, "Testing Success Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
logger.information(log, "Testing Information Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
logger.debug(log, "Testing Debug Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
logger.trace(log, "Testing Trace Log Message %s %d %f" % ("Testing String Concat", 5, 5.5))
Enable File Logging
log.set_toggle_file_logging(True)
Enable Database Logging
logger.set_toggle_file_logging(log, True)
Set File Path for Logs
logger.set_file_path(log, "C:\\Users\\YourName\\logs")
Control Log Levels
Available options:
- ALL — Logs all message types
- HIGH — Logs FATAL, ERROR, WARNING, SUCCESS
- MEDIUM — Logs FATAL, ERROR, WARNING
- LOW — Logs FATAL, ERROR
logger.set_log_level(log, LogLevel.LOW)
Tech Stack
- Language: Python 3
-
Modules:
inspect
,os
,enum
,datetime
,sqlite3
- Tools: PyCharm, DataGrip, GitHub, Git
Roadmap
- SQLite Logging
- MySQL Logging
- Multi-threaded Logging
- Async Logging
- Custom Log Message Types
Resources
- GitHub Repositories: ESTROSEC
- GitHub Project Repository: ESTROSEC
- Medium: ESTROSEC
- Dev.To: ESTROSEC
- Patreon: ESTROSEC
- Tumblr: ESTROSEC
Stay updated with new projects, tutorials, and announcements!
Want to get the latest news and updates when they come out?
We will email you with any relevant information as soon as we have it!
Send us an email with the subject line "I LOVE ESTROSEC!"
and a body of "NEWS & UPDATES YAY!"
Top comments (0)