LogStyles is a sleek and modern Python library designed to enhance your logging experience with Loguru. It offers a collection of customizable themes and formats that transform your log messages into visually appealing and structured outputs. Whether you're developing a small script or a large-scale application, LogStyles provides the flexibility and aesthetics to make your logs both informative and easy on the eyes.
- Multiple Predefined Themes: Choose from a variety of stylish themes like Catpuccin and Tokyo Night.
 - Versatile Log Formats: Utilize different log formats such as Simple, Detailed, Threaded, and Process to suit your needs.
 - Color Customization: Easily customize colors for different log levels and components.
 - Seamless Integration with Loguru: Effortlessly integrate LogStyles into your existing Loguru setup.
 
You can install LogStyles using pip:
pip install logstylesLogStyles is designed to work seamlessly with Loguru. Here's a quick guide to get you started.
import sys
from loguru import logger
from logstyles import LogStyles
def main():
    # Create a formatter with the desired theme and format
    formatter = LogStyles.get_formatter(
        theme_name='Catpuccin Mocha',          # Choose a theme
        format_name='Detailed',      # Choose a format
        delimiter=' | ',             # Optional: Customize delimiter
        timestamp_format='%Y-%m-%d %H:%M:%S'  # Optional: Customize timestamp format
    )
    
    # Configure the logger
    logger.remove()  # Remove the default logger
    logger.add(sys.stdout, format=formatter, colorize=False)  # Add LogStyles formatter
    
    # Log some messages
    logger.debug("Debug message with Mocha theme.")
    logger.info("Info message with Mocha theme.")
    logger.warning("Warning message with Mocha theme.")
    logger.error("Error message with Mocha theme.")
    logger.critical("Critical message with Mocha theme.")
if __name__ == '__main__':
    main()LogStyles comes with a variety of themes and formats. Here's how you can explore and use them:
# List of available themes
available_themes = LogStyles.get_available_themes()
print("Available Themes:", available_themes)
# List of available formats
available_formats = LogStyles.get_available_formats()
print("Available Formats:", available_formats)You can customize the formatter by specifying different parameters:
theme_name: The name of the theme you want to use (e.g.,'Catpuccin Latte','Tokyo Night Dark').format_name: The name of the log format (e.g.,'Simple','Detailed').delimiter: (Optional) A custom delimiter to separate log parts.timestamp_format: (Optional) Customize the timestamp format usingstrftimedirectives.
- Catpuccin Latte
 - Catpuccin Frappe
 - Catpuccin Macchiato
 - Catpuccin Mocha
 - Tokyo Night
 - Tokyo Night Storm
 - Tokyo Night Light
 
| Format | Example | 
|---|---|
| Simple | This is a DEBUG message. | 
| Detailed | 2024-11-28 15:11:49 | DEBUG | main | main | 39 | This is a DEBUG message. | 
| Threaded | 2024-11-28 15:11:49 | DEBUG | MainThread | This is a DEBUG message. | 
| Process | 2024-11-28 15:11:49 | DEBUG | MainProcess | This is a DEBUG message. | 
| Left Aligned | DEBUG   : This is a DEBUG message. | 
| Column | 2024-11-28 15:11:49 | DEBUG | main | This is a DEBUG message. | 
LogStyles includes a comprehensive test suite using unittest. To run the tests, navigate to the project directory and execute:
python -m unittest discover testsThis project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or feedback, feel free to reach out:
- Email: Justin@Lanfermann.DEV
 - GitHub: Justin Lanfermann
 
Made with ❤️ by Justin Lanfermann