Skip to main content

A simple, beautiful logger with a clean and intuitive interface

Project description

Loggity

A simple, beautiful logger with a clean and intuitive interface

Version Status License Python

Features

  • Colorful output: Beautiful ANSI colors for different log levels
  • Timestamps: Optional timestamps in HH:MM:SS.ms format
  • Simple API: Just create a logger and start logging
  • Multiple log levels: INFO (blue), WARN (yellow), ERROR (red), DEBUG (white), SUCCESS (green)
  • Custom headers: Create your own log types with custom colors
  • Lightweight: Pure Python, no external dependencies
  • Clean formatting: Consistent spacing and aligned output
  • Toggle features: Enable/disable colors and timestamps independently

Installation

pip install loggity

Quick Start

from loggity import Logger

# Create a logger instance with default settings (colors enabled, no timestamps)
log = Logger()

# Start logging with beautiful colors
log.info("Application started")              # Blue
log.success("Database connected successfully") # Green
log.warn("Disk space running low")           # Yellow
log.error("Failed to send email")             # Red
log.debug("Cache miss for key: user_123")     # White

Configuration

With Timestamps

Enable timestamps to track when events occur:

from loggity import Logger

# Enable both colors and timestamps
log = Logger(colored=True, timestamps=True)

# Output will include timestamps
log.info("Server started on port 8000")
# [143022] INFO:    Server started on port 8000
log.warn("Config file not found, using defaults")
# [143022] WARN:    Config file not found, using defaults

Plain Output (No Colors)

Perfect for logging to files or environments that don't support ANSI colors:

# Disable colors, keep timestamps
log = Logger(colored=False, timestamps=True)

# Output without colors
log.info("Writing to log file")
# [143022] INFO:    Writing to log file

Minimal Output

Disable both colors and timestamps for clean, simple output:

# Plain logger without any formatting
log = Logger(colored=False, timestamps=False)

log.info("Clean output")
# INFO:    Clean output

API Reference

Basic Methods

All basic methods come with predefined colors:

Method Color Description Example
info(message) Blue Informational messages log.info("Server started on port 8080")
warn(message) Yellow Warning messages log.warn("API rate limit at 90%")
error(message) Red Error messages log.error("Connection timeout")
debug(message) White Debug messages log.debug("Request payload: {...}")
success(message) Green Success messages log.success("Data exported")

Custom Logging with Colors

Create logs with custom headers and colors using the Colors class:

from loggity import Logger, Colors

log = Logger(timestamps=True)

# Custom log types with any color
log.custom("AUDIT", Colors.MAGENTA, "User admin performed deletion")
log.custom("METRIC", Colors.CYAN, "Response time: 245ms")
log.custom("SECURITY", Colors.RED, "Failed login attempt from 192.168.1.100")
log.custom("PERFORMANCE", Colors.BLUE, "Query executed in 0.3s")
log.custom("CACHE", Colors.GREEN, "Hit ratio: 94%")

Available Colors

The Colors class provides the following ANSI color codes:

Color Usage
Colors.BLACK log.custom("BLACK", Colors.BLACK, "message")
Colors.RED log.custom("RED", Colors.RED, "message")
Colors.GREEN log.custom("GREEN", Colors.GREEN, "message")
Colors.YELLOW log.custom("YELLOW", Colors.YELLOW, "message")
Colors.BLUE log.custom("BLUE", Colors.BLUE, "message")
Colors.MAGENTA log.custom("MAGENTA", Colors.MAGENTA, "message")
Colors.CYAN log.custom("CYAN", Colors.CYAN, "message")
Colors.WHITE log.custom("WHITE", Colors.WHITE, "message")

Output Format Examples

Full Features (Colors + Timestamps)

log = Logger(colored=True, timestamps=True)
log.info("Server started")
log.error("Connection failed")

Output:

[143022] INFO:    Server started
[143022] ERROR:   Connection failed

Colors Only

log = Logger(colored=True, timestamps=False)
log.success("Task completed")

Output:

SUCCESS:    Task completed

Timestamps Only

log = Logger(colored=False, timestamps=True)
log.warn("Low disk space")

Output:

[143022] WARN:    Low disk space

Plain

log = Logger(colored=False, timestamps=False)
log.custom("TEST", Colors.RED, "Color is ignored")

Output:

TEST:    Color is ignored

Complete Example

from loggity import Logger, Colors

# Logger with colors and timestamps
log = Logger(colored=True, timestamps=True)

# Basic usage
log.info("Server started on port 8000")
log.warn("Config file not found, using defaults")
log.error("Failed to connect to database")
log.debug("Received payload: {'temp': 23.5}")
log.success("Database migration completed")

# Custom usage
log.custom("METRIC", Colors.MAGENTA, "Response time: 245ms")

# Plain logger without any formatting
plain_log = Logger(colored=False, timestamps=False)
plain_log.info("Plain log entry")

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loggity-0.3.0a3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loggity-0.3.0a3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file loggity-0.3.0a3.tar.gz.

File metadata

  • Download URL: loggity-0.3.0a3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for loggity-0.3.0a3.tar.gz
Algorithm Hash digest
SHA256 1b52581d1f66d3b2aa6079e9dbd1273e62a47013efc3375f00d4de4291a85211
MD5 db81f9665f709a92190559ba792edcfc
BLAKE2b-256 1dc35918eefc47798b7134c698c1e0825451bd40f458798208c6adbb53a988b7

See more details on using hashes here.

File details

Details for the file loggity-0.3.0a3-py3-none-any.whl.

File metadata

  • Download URL: loggity-0.3.0a3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for loggity-0.3.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 8c5eee6a168b2fef880cc81de7c35021046ccf95fe4008040ea41bcece582ac0
MD5 c5fe3d453fd1462c2f461dbd96887087
BLAKE2b-256 4b26db29aa9a657bf3b1cc9a214970f2450a2ebec90e5002b1c1183ac531cf18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page