A simple, beautiful logger with a clean and intuitive interface
Project description
Loggity
A simple, beautiful logger with a clean and intuitive interface
Features
- Colorful output: Beautiful ANSI colors for different log levels
- 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 colors: Enable/disable colored output as needed
Installation
pip install loggity
Quick Start
from loggity import Logger
# Create a logger instance (colors enabled by default)
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
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()
# 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") |
Configuration
Disable Colors
If you need to disable colored output:
# Create logger without colors
log = Logger(colored=False)
# All output will be plain text
log.info("This will be without colors")
log.custom("PLAIN", Colors.RED, "Color parameter is ignored") # Color is ignored when colored=False
Output Format
Colored Output
When colors are enabled (colored=True, default), the header appears in its designated color:
INFO: Application started
SUCCESS: Database connected successfully
WARN: Disk space running low
ERROR: Failed to send email
DEBUG: Cache miss for key: user_123
AUDIT: User admin performed deletion
METRIC: Response time: 245ms
Plain Output
When colors are disabled (colored=False):
INFO: Application started
SUCCESS: Database connected successfully
WARN: Disk space running low
ERROR: Failed to send email
DEBUG: Cache miss for key: user_123
AUDIT: User admin performed deletion
METRIC: Response time: 245ms
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loggity-0.2.0a2.tar.gz.
File metadata
- Download URL: loggity-0.2.0a2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5b54e75bab8cfe7055aeddc5eb202650545315a11f9ee350d1736f231637ebe
|
|
| MD5 |
d4ec1ed7b21dabd33c2b6d28abae1392
|
|
| BLAKE2b-256 |
4bf43b312624532130afe4fdf8b23e69f3f8cd03b434852c06cb0933c9cf6ac6
|
File details
Details for the file loggity-0.2.0a2-py3-none-any.whl.
File metadata
- Download URL: loggity-0.2.0a2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e90ccb851f4630f83690afdc5dc2035e275a3035bdf2a5e5dab098f5267ab22b
|
|
| MD5 |
c18d40d0a050eb372958841692056363
|
|
| BLAKE2b-256 |
d15f4061e85d7f2c55a1b16b568c7bde9d6bd52d9975a5208bd9cd2eed81f44f
|