A stylish and colorful Python logging module with customizable console output
Project description
BeamLogger
A stylish and colorful Python logging module with customizable console output.
Features
- Beautiful colorized log output with different colors for each log level
- Custom time stamps in 12-hour format
- Stylish banners with gradient colors using pystyle
- Custom console window title (Cross-platform - Windows, Linux, macOS)
- Input prompt with styled formatting
- Multiple log levels: info, debug, log, success, input, output, error, critical, warn
Requirements
- colorama
- pystyle
- Python 3.6+
Installation
pip install BeamLogger
Usage
from beamlogger import BeamLogger
import platform
# Initialize logger with custom title
system = platform.system()
logger = BeamLogger(f"My Application on {system}")
# Display a banner
banner = """
██████╗ ███████╗ █████╗ ███╗ ███╗██╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗
██╔══██╗██╔════╝██╔══██╗████╗ ████║██║ ██╔═══██╗██╔════╝ ██╔════╝ ██╔════╝██╔══██╗
██████╔╝█████╗ ███████║██╔████╔██║██║ ██║ ██║██║ ███╗██║ ███╗█████╗ ██████╔╝
██╔══██╗██╔══╝ ██╔══██║██║╚██╔╝██║██║ ██║ ██║██║ ██║██║ ██║██╔══╝ ██╔══██╗
██████╔╝███████╗██║ ██║██║ ╚═╝ ██║███████╗╚██████╔╝╚██████╔╝╚██████╔╝███████╗██║ ██║
╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
"""
logger.banner(banner)
# Different log levels
logger.info("This is an information message")
logger.debug("This is a debug message")
logger.log("This is a regular log message")
logger.success("This is a success message")
logger.warn("This is a warning message")
logger.error("This is an error message")
logger.critical("This is a critical message")
# Get user input
name = logger.input("Please enter your name", "Name")
logger.info(f"Hello, {name}!")
# Change console title
logger.set_title(f"New Title - {name}")
Log Format
The log format follows this pattern:
[Time stamp in 12hrs] ❆ [PREFIX] ➔ Message
For example:
[09:45:32 AM] ❆ [INFO] ➔ This is an information message
Custom Banners
You can create custom banners with different colors:
logger.banner("Your ASCII Art Here", color=pystyle.Colors.purple_to_blue, spacing=10)
Running the Example
To see BeamLogger in action, run the included example:
py example.py
Changelog
v0.1.3
- Added cross-platform support for console title setting (Windows, Linux, macOS)
- Fixed console title setting errors on Linux systems
- Improved error handling for platform-specific features
Crafted With <3 By Bhaskar
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
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 BeamLogger-0.1.5.tar.gz.
File metadata
- Download URL: BeamLogger-0.1.5.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa96a5cbc4db3c6a295eb3176740a2ea262d38ebb79c7617dd6d383cd4296d5d
|
|
| MD5 |
9ff6edab5bfacd197cf3317af6b3a75c
|
|
| BLAKE2b-256 |
0fb4f94b2d8ca7b1c32c10dc619a0e4fcbddbd5ad39ecbba6d41f8c6edc7ae5d
|
File details
Details for the file BeamLogger-0.1.5-py3-none-any.whl.
File metadata
- Download URL: BeamLogger-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f31d41414d0ca6c9dcd6848887f69fbab9f07e36712ef756be8b71f78f3e80ae
|
|
| MD5 |
0a903cba4e9dc38e7524f7f3ee4fd20c
|
|
| BLAKE2b-256 |
024d1f45ac4f46d43adda911649b9f564e8ec43fdb70b5fb7a3d672dcf2cdeab
|