Skip to main content

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

  1. Fork the repository.

  2. Create a new branch (git checkout -b feature/amazing-feature).

  3. Commit your changes (git commit -m 'Add amazing feature').

  4. Push to the branch (git push origin feature/amazing-feature).

  5. 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


Download files

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

Source Distribution

log_candy-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

log_candy-0.1.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for log_candy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fd356ffbb75024fdfa04980dd438dd398f1b4e7a4dbb09bf972fe9ace8e974f7
MD5 ad88d40096d6d702070821e9a8310329
BLAKE2b-256 9c10fbc57c1316c3a87ca118f90c38f71d3a86b3ed9283bdbf7b05a43f5ac304

See more details on using hashes here.

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

Hashes for log_candy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1d54855813c2b987415ee73697d74df227f69ef10589bd2323d1ef78bdc357f6
MD5 bb66e59165e78428b3e369820b6065b1
BLAKE2b-256 e96d23cda9cf544a934d52726c6227cafe183716e26c3b3ce963c4cdc29f826e

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