# LogStyles
![PyPI](https://img.shields.io/pypi/v/logstyles)
![License](https://img.shields.io/pypi/l/logstyles)
![Python Versions](https://img.shields.io/pypi/pyversions/logstyles)
![Tests](https://github.com/jaylann/logstyles/actions/workflows/python-app.yml/badge.svg)
## ๐ Introduction
**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.
## ๐ Features
- **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.
## ๐ฆ Installation
You can install LogStyles using `pip`:
```bash
pip install logstyles
```
## ๐ ๏ธ Usage
LogStyles is designed to work seamlessly with **Loguru**. Here's a quick guide to get you started.
### ๐ Basic Example
```python
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()
```
### ๐จ Selecting Themes and Formats
LogStyles comes with a variety of themes and formats. Here's how you can explore and use them:
```python
# 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)
```
## โ๏ธ Configuration
### ๐ง Customizing the Formatter
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 using `strftime` directives.
## ๐ Available Themes and Formats
### ๐จ Themes
- **Catpuccin Latte**
- **Catpuccin Frappe**
- **Catpuccin Macchiato**
- **Catpuccin Mocha**
- **Tokyo Night**
- **Tokyo Night Storm**
- **Tokyo Night Light**
### ๐ Formats
| **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.` |
## ๐งช Testing
LogStyles includes a comprehensive test suite using `unittest`. To run the tests, navigate to the project directory and execute:
```bash
python -m unittest discover tests
```
## ๐ License
This project is licensed under the [MIT License](LICENSE). See the [LICENSE](LICENSE) file for details.
## ๐ฌ Contact
For any inquiries or feedback, feel free to reach out:
- **Email**: [Justin@Lanfermann.DEV](mailto:Justin@Lanfermann.dev)
- **GitHub**: [Justin Lanfermann](https://github.com/jaylann)
Raw data
{
"_id": null,
"home_page": "https://github.com/jaylann/logstyles",
"name": "logstyles",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.7",
"maintainer_email": null,
"keywords": "logging loguru log styles themes formats",
"author": "Justin Lanfermann",
"author_email": "Justin@Lanfermann.dev",
"download_url": "https://files.pythonhosted.org/packages/52/23/c89d22589c2ea45934b3f940b841ecf86f3ec0116fc335d97c079b2139b1/logstyles-0.1.4.tar.gz",
"platform": null,
"description": "# LogStyles\n\n![PyPI](https://img.shields.io/pypi/v/logstyles)\n![License](https://img.shields.io/pypi/l/logstyles)\n![Python Versions](https://img.shields.io/pypi/pyversions/logstyles)\n![Tests](https://github.com/jaylann/logstyles/actions/workflows/python-app.yml/badge.svg)\n\n\n## \ud83c\udf1f Introduction\n\n**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.\n\n## \ud83d\ude80 Features\n\n- **Multiple Predefined Themes**: Choose from a variety of stylish themes like **Catpuccin** and **Tokyo Night**.\n- **Versatile Log Formats**: Utilize different log formats such as **Simple**, **Detailed**, **Threaded**, and **Process** to suit your needs.\n- **Color Customization**: Easily customize colors for different log levels and components.\n- **Seamless Integration with Loguru**: Effortlessly integrate LogStyles into your existing Loguru setup.\n\n## \ud83d\udce6 Installation\n\nYou can install LogStyles using `pip`:\n\n```bash\npip install logstyles\n```\n\n## \ud83d\udee0\ufe0f Usage\n\nLogStyles is designed to work seamlessly with **Loguru**. Here's a quick guide to get you started.\n\n### \ud83d\udcda Basic Example\n\n```python\nimport sys\nfrom loguru import logger\nfrom logstyles import LogStyles\n\ndef main():\n # Create a formatter with the desired theme and format\n formatter = LogStyles.get_formatter(\n theme_name='Catpuccin Mocha', # Choose a theme\n format_name='Detailed', # Choose a format\n delimiter=' | ', # Optional: Customize delimiter\n timestamp_format='%Y-%m-%d %H:%M:%S' # Optional: Customize timestamp format\n )\n \n # Configure the logger\n logger.remove() # Remove the default logger\n logger.add(sys.stdout, format=formatter, colorize=False) # Add LogStyles formatter\n \n # Log some messages\n logger.debug(\"Debug message with Mocha theme.\")\n logger.info(\"Info message with Mocha theme.\")\n logger.warning(\"Warning message with Mocha theme.\")\n logger.error(\"Error message with Mocha theme.\")\n logger.critical(\"Critical message with Mocha theme.\")\n\nif __name__ == '__main__':\n main()\n```\n\n### \ud83c\udfa8 Selecting Themes and Formats\n\nLogStyles comes with a variety of themes and formats. Here's how you can explore and use them:\n\n```python\n# List of available themes\navailable_themes = LogStyles.get_available_themes()\nprint(\"Available Themes:\", available_themes)\n\n# List of available formats\navailable_formats = LogStyles.get_available_formats()\nprint(\"Available Formats:\", available_formats)\n```\n\n## \u2699\ufe0f Configuration\n\n### \ud83d\udd27 Customizing the Formatter\n\nYou can customize the formatter by specifying different parameters:\n\n- **`theme_name`**: The name of the theme you want to use (e.g., `'Catpuccin Latte'`, `'Tokyo Night Dark'`).\n- **`format_name`**: The name of the log format (e.g., `'Simple'`, `'Detailed'`).\n- **`delimiter`**: (Optional) A custom delimiter to separate log parts.\n- **`timestamp_format`**: (Optional) Customize the timestamp format using `strftime` directives.\n\n\n## \ud83d\udcc2 Available Themes and Formats\n\n### \ud83c\udfa8 Themes\n\n- **Catpuccin Latte**\n- **Catpuccin Frappe**\n- **Catpuccin Macchiato**\n- **Catpuccin Mocha**\n- **Tokyo Night**\n- **Tokyo Night Storm**\n- **Tokyo Night Light**\n\n### \ud83d\udcdd Formats\n\n| **Format** | **Example** |\n|------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| **Simple** | `This is a DEBUG message.` |\n| **Detailed** | `2024-11-28 15:11:49 \\| DEBUG \\| main \\| main \\| 39 \\| This is a DEBUG message.` |\n| **Threaded** | `2024-11-28 15:11:49 \\| DEBUG \\| MainThread \\| This is a DEBUG message.` |\n| **Process** | `2024-11-28 15:11:49 \\| DEBUG \\| MainProcess \\| This is a DEBUG message.` |\n| **Left Aligned** | `DEBUG : This is a DEBUG message.` |\n| **Column** | `2024-11-28 15:11:49 \\| DEBUG \\| main \\| This is a DEBUG message.` |\n\n## \ud83e\uddea Testing\n\nLogStyles includes a comprehensive test suite using `unittest`. To run the tests, navigate to the project directory and execute:\n\n```bash\npython -m unittest discover tests\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the [MIT License](LICENSE). See the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udcec Contact\n\nFor any inquiries or feedback, feel free to reach out:\n\n- **Email**: [Justin@Lanfermann.DEV](mailto:Justin@Lanfermann.dev)\n- **GitHub**: [Justin Lanfermann](https://github.com/jaylann)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A logging styling library for Loguru with customizable themes and formats.",
"version": "0.1.4",
"project_urls": {
"Bug Reports": "https://github.com/jaylann/logstyles/issues",
"Homepage": "https://github.com/jaylann/logstyles",
"Source": "https://github.com/jaylann/logstyles/"
},
"split_keywords": [
"logging",
"loguru",
"log",
"styles",
"themes",
"formats"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8be9d45c4c9247f92fd1273da1e0d3718bb37f08d7aeece63be133acf3d1e57d",
"md5": "9da1b37357715960a71c1f9a9be3c9a2",
"sha256": "d9353fe5f2fea0c6a1119198453f4ee9d2c88edbed44c396203a2a6531c07575"
},
"downloads": -1,
"filename": "logstyles-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9da1b37357715960a71c1f9a9be3c9a2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.7",
"size": 10105,
"upload_time": "2024-12-05T12:39:32",
"upload_time_iso_8601": "2024-12-05T12:39:32.860215Z",
"url": "https://files.pythonhosted.org/packages/8b/e9/d45c4c9247f92fd1273da1e0d3718bb37f08d7aeece63be133acf3d1e57d/logstyles-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5223c89d22589c2ea45934b3f940b841ecf86f3ec0116fc335d97c079b2139b1",
"md5": "4907228fcfeda1881e665818a8780739",
"sha256": "c647e45d47b6f1b40272f671e3c75ab492ee26c9905b7e887391b53a393d9336"
},
"downloads": -1,
"filename": "logstyles-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "4907228fcfeda1881e665818a8780739",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.7",
"size": 14356,
"upload_time": "2024-12-05T12:39:34",
"upload_time_iso_8601": "2024-12-05T12:39:34.929055Z",
"url": "https://files.pythonhosted.org/packages/52/23/c89d22589c2ea45934b3f940b841ecf86f3ec0116fc335d97c079b2139b1/logstyles-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 12:39:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jaylann",
"github_project": "logstyles",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "loguru",
"specs": [
[
"==",
"0.7.2"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"68.0.0"
]
]
}
],
"lcname": "logstyles"
}