PitchHut logo
Log in / Sign up
Tamga
by dogukanurker
A modern logging utility for Python with vibrant console outputs.
Pitch

Tamga offers a versatile logging solution for Python developers, featuring colorful console outputs and multiple logging options, including file, JSON, SQLite, and MongoDB integrations. Enhance logging capabilities with email notifications and customizable log levels, making it easy to maintain project oversight and swiftly identify issues.

Description

Tamga is a modern logging utility designed for Python, offering versatile output formats and vibrant console displays. This tool enhances the logging experience through a variety of features:

Key Features

  • Colorful Console Output: Leverage the Tailwind CSS color palette for visually appealing log messages.
  • File Logging: Enjoy automatic rotation and backup functionality for file logs.
  • JSON Logging: Manage JSON logs with size limits and backup capabilities.
  • SQLite Database Logging: Streamline log storage with SQLite support.
  • MongoDB Integration: Effortlessly log to MongoDB databases.
  • Email Notifications: Receive email alerts for critical log events.
  • API Logging: Integrate logging with various APIs for enhanced flexibility.
  • Automatic Rotation and Backup: Maintain optimal log file sizes with built-in management features.
  • Customizable Log Levels: Define multiple log levels and associate them with specific colors for better identification.

Usage Examples

Basic Logging

from tamga import Tamga  
logger = Tamga(logToFile=True, logToJSON=True, logToConsole=True)  
logger.info("This is an info message")  
logger.warning("This is a warning")  
logger.error("This is an error")  
logger.success("This is a success message")  
logger.debug("This is a debug message")  
logger.critical("This is a critical message")  
logger.custom("This is a custom message", "CUSTOM", "orange")  

Advanced Features
MongoDB Integration

logger = Tamga(logToMongo=True, mongoURI="your_mongodb_uri", mongoDatabaseName="logs_db", mongoCollectionName="application_logs")  

Email Notifications

logger = Tamga(sendMail=True, smtpServer="smtp.gmail.com", smtpPort=587, smtpMail="your_email@gmail.com", smtpPassword="your_password", smtpReceivers=["receiver@email.com"], mailLevels=["CRITICAL", "ERROR"])  

File Rotation and Backup

logger = Tamga(logToFile=True, logToJSON=True, maxLogSize=10, maxJsonSize=10, enableBackup=True)  

API Integration

logger = Tamga(logToAPI=True, apiURL="http://your-api.com/logs")  

Log Levels

  • INFO (sky blue)
  • WARNING (amber)
  • ERROR (rose)
  • SUCCESS (emerald)
  • DEBUG (indigo)
  • CRITICAL (red)
  • DATABASE (green)
  • MAIL (neutral)
  • METRIC (cyan)
  • TRACE (gray)
  • Custom (user-defined)

Tamga aims to streamline and enhance the logging process in Python applications, presenting an accessible and flexible solution for developers. Contributions to the project are welcome, fostering continuous improvement.

0 comments

No comments yet.

Sign in to be the first to comment.