A simple Python logging utility for colorful terminal output
Project description
Log Candy
Log Candy is a simple and colorful logging utility designed to make your debug messages more delightful and informative. It provides easy-to-use functions for logging messages with different levels of importance, using vibrant colors for better distinction.
Features
-
🌈 Color-Coded Logs: Debug, Info, Warning, Error, and Result messages are each represented with a unique color for easy identification.
-
📝 Readable Formatting: Automatically formats multiline messages for improved readability.
-
🎚️ Log Level Control: Set minimum log levels to filter out less important messages and reduce noise.
-
🛠️ Customizable Use: Straightforward integration to be used anywhere in your Python projects.
Installation
You can install Log Candy via pip:
pip install log-candy
Requirements
- Python 3 version or higher is required.
Dependencies
The package also carries the following dependencies (requirements.txt) for better use:
tqdm==4.66.4
Usage
Import Log Candy and start logging colorful messages in your project:
from log_candy import log_debug, log_info, log_warning, log_error, log_result
# Classic logging
log_debug("This is a debug message.")
log_info("This is an info message.")
log_warning("This is a warning message.")
log_error("This is an error message.")
log_result("This is a result message.")
# Multiline logging
log_debug("This is a debug message.\nThis is a multiline debug message.")
log_info("This is an info message.\nThis is a multiline info message.")
log_warning("This is a warning message.\nThis is a multiline warning message.")
log_error("This is an error message.\nThis is a multiline error message.")
log_result("This is a result message.\nThis is a multiline result message.")
Log Levels
You can control which logs are displayed by setting a minimum log level. Only logs at or above the set level will be shown:
from log_candy import set_log_level, get_log_level, LOG_LEVELS
# Set log level to show only warnings and errors
set_log_level('WARNING')
log_debug("This won't be shown") # Hidden
log_info("This won't be shown") # Hidden
log_warning("This will be shown") # Visible
log_error("This will be shown") # Visible
# Check current log level
current_level = get_log_level()
print(f"Current log level: {current_level}")
# Available log levels (in order of priority):
# DEBUG (10) - Shows all logs
# INFO (20) - Shows info, result, warning, and error logs
# RESULT (25) - Shows result, warning, and error logs
# WARNING (30) - Shows warning and error logs
# ERROR (40) - Shows only error logs
# You can also access the LOG_LEVELS dictionary
print("Available levels:", LOG_LEVELS)
Why Use Log Candy?
-
🛠 Ease of Use: No setup required, just import and start logging.
-
🌟 Improved Clarity: Quickly identify different types of logs by their color-coded format.
-
💡 Multiline Support: Automatically indents subsequent lines to keep your logs neat.
-
🎯 Focused Debugging: Use log levels to show only the information you need, when you need it.
Contributing
Contributions are welcome! If you have suggestions for improvements, please feel free to open an issue or create a pull request.
Steps to Contribute
-
Fork the repository.
-
Create a new branch (
git checkout -b feature/amazing-feature). -
Commit your changes (
git commit -m 'Add amazing feature'). -
Push to the branch (
git push origin feature/amazing-feature). -
Open a Pull Request.
Acknowledgements
Special thanks to anyone who finds this project useful and helps make it better!
Enjoy logging with Log Candy 🍭!
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 log_candy-0.1.3.tar.gz.
File metadata
- Download URL: log_candy-0.1.3.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd356ffbb75024fdfa04980dd438dd398f1b4e7a4dbb09bf972fe9ace8e974f7
|
|
| MD5 |
ad88d40096d6d702070821e9a8310329
|
|
| BLAKE2b-256 |
9c10fbc57c1316c3a87ca118f90c38f71d3a86b3ed9283bdbf7b05a43f5ac304
|
File details
Details for the file log_candy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: log_candy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d54855813c2b987415ee73697d74df227f69ef10589bd2323d1ef78bdc357f6
|
|
| MD5 |
bb66e59165e78428b3e369820b6065b1
|
|
| BLAKE2b-256 |
e96d23cda9cf544a934d52726c6227cafe183716e26c3b3ce963c4cdc29f826e
|