richcolorlog


Namerichcolorlog JSON
Version 1.44.12 PyPI version JSON
download
home_pagehttps://github.com/cumulus13/richcolorlog
SummaryA beautiful and feature-rich logging package using Rich library
upload_time2025-10-06 18:48:50
maintainerNone
docs_urlNone
authorHadi Cahyadi
requires_python>=3.7
licenseMIT
keywords logging rich console terminal colors formatting
VCS
bugtrack_url
requirements rich
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ๐ŸŒˆ **richcolorlog** โ€“ Beautiful, Powerful & Multi-Output Logging for Python

> โœจ **Log like a pro** with emoji icons, syntax highlighting, custom log levels, and support for **console, file, RabbitMQ, Kafka, ZeroMQ, Syslog, and databases** โ€” all in one package!

[![PyPI version](https://img.shields.io/pypi/v/richcolorlog.svg?color=blue&logo=pypi)](https://pypi.org/project/richcolorlog/)
[![Python Versions](https://img.shields.io/pypi/pyversions/richcolorlog.svg?logo=python)](https://pypi.org/project/richcolorlog/)
[![License](https://img.shields.io/github/license/cumulus13/richcolorlog?color=green)](https://github.com/cumulus13/richcolorlog/blob/main/LICENSE)
[![Downloads](https://static.pepy.tech/badge/richcolorlog)](https://pepy.tech/project/richcolorlog)

[![Screenshot](https://raw.githubusercontent.com/cumulus13/richcolorlog/master/screenshot.png)](https://raw.githubusercontent.com/cumulus13/richcolorlog/master/screenshot.png)

---

## ๐Ÿš€ Features

- โœ… **Rich Console Output** with colors, backgrounds, and **emoji icons** per log level  
- ๐ŸŽจ **Syntax Highlighting** for code snippets (Python, SQL, JSON, etc.) via `lexer='python'`  
- ๐ŸŽฏ **Custom Log Levels**: `EMERGENCY`, `ALERT`, `NOTICE`, `FATAL` (Syslog-compliant)  
- ๐Ÿ“ฆ **Multi-Handler Support**:  
  - ๐Ÿ–ฅ๏ธ Console (Rich + ANSI fallback)  
  - ๐Ÿ“„ File (with level-based formatting)  
  - ๐Ÿ‡ RabbitMQ  
  - ๐Ÿ“ก Kafka  
  - ๐Ÿ“ก ZeroMQ  
  - ๐Ÿ“ก Syslog  
  - ๐Ÿ—„๏ธ PostgreSQL / MySQL / MariaDB / SQLite  

- ๐Ÿงช **Jupyter/IPython Friendly** (no async warnings!)  
- ๐Ÿงฉ **Full LogRecord Template Support**: `%(asctime)s`, `%(funcName)s`, `%(threadName)s`, `%(icon)s`, etc.  
- ๐Ÿ” **Smart Timestamp**: Repeated timestamps are hidden (like `RichHandler` original)
- ๐ŸŽจ **Custom Colors**: Set color per level (`info_color`, `error_color`, etc.)
- โš™๏ธ **Highly Configurable**: `icon_first`, `level_in_message`, `show_background`, etc.  
- ๐Ÿš€ **Easy to use** - Simple setup with sensible defaults
- โšก **Zero required dependencies** (only `rich` for Rich mode; brokers optional)
- ๐ŸŽจ **Support any terminal** - with ansi color Fallback

---

## ๐Ÿ“ฆ Installation

Install from PyPI:

```bash
pip install richcolorlog
```

> ๐Ÿ’ก **Optional**: Install extras for message brokers:
> ```bash
> pip install richcolorlog[rabbitmq,kafka,zmq,db]
> ```

Or install from source:

```bash
git clone https://github.com/cumulus13/richcolorlog
cd richcolorlog
pip install -e .
```

---

## ๐Ÿงช Quick Start

### Basic Usage (Rich Console)

```python
>>> from richcolorlog import setup_logging

>>> logger = setup_logging(
        name="myapp",
        show_background=True,
        show_icon=True,
        icon_first=True
    )
>>> logger.emergency("This is an emergency message")
    logger.alert("This is an alert message")
    logger.critical("This is a critical message")
    logger.error("This is an error message")
    logger.warning("This is a warning message")
    logger.notice("This is a notice message")
    logger.info("This is an info message")
    logger.debug("This is a debug message")
>>> # output
    ๐Ÿ†˜ [10/04/25 14:12:07] EMERGENCY This is an emergency message
    ๐Ÿšจ [10/04/25 14:12:07] ALERT    This is an alert message
    ๐Ÿ’ฅ [10/04/25 14:12:07] CRITICAL This is a critical message
    โŒ [10/04/25 14:12:07] ERROR    This is an error message
    โ›” [10/04/25 14:12:07] WARNING  This is a warning message
    ๐Ÿ“ข [10/04/25 14:12:07] NOTICE   This is a notice message
    ๐Ÿ”” [10/04/25 14:12:07] INFO     This is an info message
    ๐Ÿ› [10/04/25 14:12:07] DEBUG    This is a debug message

>>> FORMAT = "%(icon)s %(asctime)s - %(name)s - %(process)d - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)"
>>> logger = setup_logging(show_background=True, format_template=FORMAT, name="TEST")
>>> code = """
    def hello():
        print("Hello World")
    """
>>> logger.info(code, lexer='python')
>>> #output
    ๐Ÿ”” [10/04/25 15:12:34] TEST 15448 INFO

    def hello():
        print("Hello World")

>>> logger.debug("SELECT * FROM users", lexer="sql")  # Syntax highlighted!
>>> #output
    ๐Ÿ› [10/04/25 15:12:35] TEST 15448 DEBUG                                
    SELECT * FROM users

```

### With Custom Format Template

```python
template = "%(asctime)s | %(levelname)s | %(name)s | %(funcName)s() | %(message)s"

logger = setup_logging(
    name="api",
    format_template=template,
    show_background=False
)

logger.notice("User logged in successfully ๐Ÿ”‘")
```

### Custom Format Template + Icon in Template

```python
FORMAT = "%(icon)s %(asctime)s - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)"

logger = setup_logging(
    name="TEST",
    format_template=FORMAT,
    icon_first=True,           # Icon always at start (overrides template position)
    omit_repeated_times=True   # Hide repeated timestamps
)

logger.info("Hello world")
# Output:
# ๐Ÿ”” [10/06/25 15:30:00] INFO - Hello world (test.py:10)
# ๐Ÿ””                     INFO - Another message (test.py:11)
```

### Show Level in Message (`level_in_message=True`)

```python
logger = setup_logging(level_in_message=True)
logger.info("This is a message")
# Output: INFO - This is a message
```

### Simple Logger (No Rich, for Jupyter)

```python
from richcolorlog import setup_logging_custom

logger = setup_logging_custom(
    name="notebook",
    show_icon=True,
    icon_first=False,
    show_background=False
)

logger.info("Running analysis in Jupyter ๐Ÿ“Š")
```

---

## ๐ŸŽฏ Advanced Examples

### ๐Ÿ”Œ Send Logs to Kafka & File Logging

```python
logger = setup_logging(
    name="producer",
    log_file=True,
    log_file_name="app.log",
    kafka=True,
    kafka_host="localhost",
    kafka_port=9092,
    kafka_topic="app-logs",
    level="DEBUG"
)

logger.alert("Critical system event! ๐Ÿšจ")
```

### ๐Ÿ—„๏ธ Log to PostgreSQL

```python
logger = setup_logging(
    db=True,
    db_type="postgresql",
    db_host="localhost",
    db_name="logs",
    db_user="admin",
    db_password="secret"
)

logger.emergency("Database connection lost!")
```

### ๐ŸŽจ Custom Colors per Level

```python
logger = setup_logging(
    info_color="#00FFAA",
    error_color="bold red on #111111",
    warning_color="yellow",
    show_background=True
)
logger.info("Custom color!")
logger.error("Custom background!")
```

### ๐Ÿง  Custom Log Levels

```python
logger.notice("New user registered ๐Ÿ“ข")      # Custom level 25
logger.fatal("Fatal error โ€” shutting down ๐Ÿ’€")  # Level 55
logger.alert("Immediate action required! ๐Ÿšจ")   # Level 59
```

### ๐Ÿง  Custom Log Levels (Correct Location!)

```python
# File: test.py
logger = setup_logging(name="test")
logger.emergency("System down!")  # Shows: test.py:5 (not logger.py!)
```

```
import logging
logger = logging.getLogger("INHERITANCE")
from richcolorlog import RichColorLogHandler
handler = RichColorLogHandler()
logger.handlers.clear()
logger.addHandler(handler)
logger.propagate = False

logger.emergency("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")
logger.alert("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")
logger.critical("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")
logger.error("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")
logger.warning("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")
logger.notice("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")
logger.debug("RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter")

```
---

## ๐Ÿ› ๏ธ Configuration Options

| Parameter | Description | Default |
|----------|------------|--------|
| `show_icon` | Show emoji icons | `True` |
| `icon_first` | Icon before timestamp | `True` |
| `format_template` | Log format (supports `%(icon)s`) | `None` |
| `level_in_message` | Prefix message with `"LEVEL - "` | `False` |
| `omit_repeated_times` | Hide repeated timestamps | `True` |
| `show_background` | Enable background colors | `True` |
| `..._color` | Custom color per level (`info_color`, `error_color`, etc.) | Default |
| All `RichHandler` args | `tracebacks_show_locals`, `keywords`, `highlighter`, etc. | Fully supported |

> โœ… If `format_template` contains `%(icon)s`, the icon is **still controlled by `icon_first`** โ€” no duplicates.

---

## ๐Ÿฆ Available Lexers

You can use any lexer supported by Pygments for syntax highlighting:

- `"python"` - Python code
- `"javascript"` - JavaScript code
- `"sql"` - SQL queries  
- `"json"` - JSON data
- `"yaml"` - YAML configuration
- `"bash"` - Shell scripts
- And many more...

## ๐Ÿ‡ Custom Log Levels

richcolorlog adds several custom log levels above the standard CRITICAL level:

| Level | Numeric Value | Description |
|-------|---------------|-------------|
| NOTICE | 55 | Informational messages |
| ALERT | 60 | Alert conditions |
| CRITICAL | 65 | Critical conditions |
| FATAL | 70 | Fatal errors |
| EMERGENCY | 75 | System is unusable |

---

## ๐Ÿงฉ Supported Log Record Fields in Templates

You can use **any standard `LogRecord` field** in your `format_template`:

```text
%(asctime)s       โ†’ 2025-10-03 14:30:00
%(name)s          โ†’ myapp
%(levelname)s     โ†’ INFO
%(message)s       โ†’ Your log message
%(filename)s      โ†’ app.py
%(lineno)d        โ†’ 42
%(funcName)s      โ†’ main
%(process)d       โ†’ 12345
%(thread)d        โ†’ 67890
%(module)s        โ†’ app
%(pathname)s      โ†’ /path/to/app.py
%(created)f       โ†’ 1728000000.123
%(msecs)d         โ†’ 123
%(relativeCreated)d โ†’ 456
%(processName)s   โ†’ MainProcess
%(threadName)s    โ†’ Thread-1
%(icon)s          โ†’ ๐Ÿž (auto-injected)
```

> โœ… **Custom fields** from `extra={}` are also supported!

---

## ๐ŸŒ Compatibility

- โœ… **Python 3.8+**
- โœ… **Jupyter Notebook / IPython** (auto-detects and disables async features)
- โœ… **Terminals** (Windows, macOS, Linux)
- โœ… **Docker / CI Environments** (falls back to ANSI if needed)

---

## ๐Ÿ“š Why Use `richcolorlog`?

| Feature | Standard `logging` | `rich` | `richcolorlog` |
|--------|-------------------|--------|----------------|
| Emoji Icons | โŒ | โŒ | โœ… |
| Custom Levels (`NOTICE`, `ALERT`) | โŒ | โŒ | โœ… |
| Syntax Highlighting | โŒ | โŒ | โœ… |
| Multi-Output (File + Kafka + DB) | Manual | โŒ | โœ… |
| Template + Icon | โŒ | Limited | โœ… |
| Accurate File/Line | โœ… | โŒ | โœ… |
| Jupyter Safe | โŒ | โš ๏ธ | โœ… |
| Repeated Timestamps | โŒ | โœ… | โœ… 
| Custom Format Templates | โœ… | Limited | โœ… + **icon support** |

---

## ๐Ÿ™ Acknowledgements

- Built on top of [`rich`](https://github.com/Textualize/rich) by Will McGugan with ansi color Fallback if no rich installed  
- Icons from [EmojiOne](https://emojione.com/)
---

## ๐Ÿ“œ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

MIT ยฉ [Hadi Cahyadi](https://github.com/cumulus13)

---

## ๐Ÿ”— Links

- ๐Ÿ“ฆ **PyPI**: https://pypi.org/project/richcolorlog/  
- ๐Ÿ’ป **GitHub**: https://github.com/cumulus13/richcolorlog  
- ๐Ÿ“ง **Author**: cumulus13@gmail.com

---

> ๐Ÿ’ฌ **Made with โค๏ธ for developers who love beautiful, informative logs!**  
> โญ **Star the repo if you find it useful!**


## author
[Hadi Cahyadi](mailto:cumulus13@gmail.com)
    

[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)

[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)
 
[Support me on Patreon](https://www.patreon.com/cumulus13)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cumulus13/richcolorlog",
    "name": "richcolorlog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Hadi Cahyadi <cumulus13@gmail.com>",
    "keywords": "logging, rich, console, terminal, colors, formatting",
    "author": "Hadi Cahyadi",
    "author_email": "Hadi Cahyadi <cumulus13@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a7/06/cd17ae30041d8f95774bb8225daf66803557c91bd8d5c5731b05c8e98d1c/richcolorlog-1.44.12.tar.gz",
    "platform": null,
    "description": "# \ud83c\udf08 **richcolorlog** \u2013 Beautiful, Powerful & Multi-Output Logging for Python\r\n\r\n> \u2728 **Log like a pro** with emoji icons, syntax highlighting, custom log levels, and support for **console, file, RabbitMQ, Kafka, ZeroMQ, Syslog, and databases** \u2014 all in one package!\r\n\r\n[![PyPI version](https://img.shields.io/pypi/v/richcolorlog.svg?color=blue&logo=pypi)](https://pypi.org/project/richcolorlog/)\r\n[![Python Versions](https://img.shields.io/pypi/pyversions/richcolorlog.svg?logo=python)](https://pypi.org/project/richcolorlog/)\r\n[![License](https://img.shields.io/github/license/cumulus13/richcolorlog?color=green)](https://github.com/cumulus13/richcolorlog/blob/main/LICENSE)\r\n[![Downloads](https://static.pepy.tech/badge/richcolorlog)](https://pepy.tech/project/richcolorlog)\r\n\r\n[![Screenshot](https://raw.githubusercontent.com/cumulus13/richcolorlog/master/screenshot.png)](https://raw.githubusercontent.com/cumulus13/richcolorlog/master/screenshot.png)\r\n\r\n---\r\n\r\n## \ud83d\ude80 Features\r\n\r\n- \u2705 **Rich Console Output** with colors, backgrounds, and **emoji icons** per log level  \r\n- \ud83c\udfa8 **Syntax Highlighting** for code snippets (Python, SQL, JSON, etc.) via `lexer='python'`  \r\n- \ud83c\udfaf **Custom Log Levels**: `EMERGENCY`, `ALERT`, `NOTICE`, `FATAL` (Syslog-compliant)  \r\n- \ud83d\udce6 **Multi-Handler Support**:  \r\n  - \ud83d\udda5\ufe0f Console (Rich + ANSI fallback)  \r\n  - \ud83d\udcc4 File (with level-based formatting)  \r\n  - \ud83d\udc07 RabbitMQ  \r\n  - \ud83d\udce1 Kafka  \r\n  - \ud83d\udce1 ZeroMQ  \r\n  - \ud83d\udce1 Syslog  \r\n  - \ud83d\uddc4\ufe0f PostgreSQL / MySQL / MariaDB / SQLite  \r\n\r\n- \ud83e\uddea **Jupyter/IPython Friendly** (no async warnings!)  \r\n- \ud83e\udde9 **Full LogRecord Template Support**: `%(asctime)s`, `%(funcName)s`, `%(threadName)s`, `%(icon)s`, etc.  \r\n- \ud83d\udd01 **Smart Timestamp**: Repeated timestamps are hidden (like `RichHandler` original)\r\n- \ud83c\udfa8 **Custom Colors**: Set color per level (`info_color`, `error_color`, etc.)\r\n- \u2699\ufe0f **Highly Configurable**: `icon_first`, `level_in_message`, `show_background`, etc.  \r\n- \ud83d\ude80 **Easy to use** - Simple setup with sensible defaults\r\n- \u26a1 **Zero required dependencies** (only `rich` for Rich mode; brokers optional)\r\n- \ud83c\udfa8 **Support any terminal** - with ansi color Fallback\r\n\r\n---\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nInstall from PyPI:\r\n\r\n```bash\r\npip install richcolorlog\r\n```\r\n\r\n> \ud83d\udca1 **Optional**: Install extras for message brokers:\r\n> ```bash\r\n> pip install richcolorlog[rabbitmq,kafka,zmq,db]\r\n> ```\r\n\r\nOr install from source:\r\n\r\n```bash\r\ngit clone https://github.com/cumulus13/richcolorlog\r\ncd richcolorlog\r\npip install -e .\r\n```\r\n\r\n---\r\n\r\n## \ud83e\uddea Quick Start\r\n\r\n### Basic Usage (Rich Console)\r\n\r\n```python\r\n>>> from richcolorlog import setup_logging\r\n\r\n>>> logger = setup_logging(\r\n        name=\"myapp\",\r\n        show_background=True,\r\n        show_icon=True,\r\n        icon_first=True\r\n    )\r\n>>> logger.emergency(\"This is an emergency message\")\r\n    logger.alert(\"This is an alert message\")\r\n    logger.critical(\"This is a critical message\")\r\n    logger.error(\"This is an error message\")\r\n    logger.warning(\"This is a warning message\")\r\n    logger.notice(\"This is a notice message\")\r\n    logger.info(\"This is an info message\")\r\n    logger.debug(\"This is a debug message\")\r\n>>> # output\r\n    \ud83c\udd98 [10/04/25 14:12:07] EMERGENCY This is an emergency message\r\n    \ud83d\udea8 [10/04/25 14:12:07] ALERT    This is an alert message\r\n    \ud83d\udca5 [10/04/25 14:12:07] CRITICAL This is a critical message\r\n    \u274c [10/04/25 14:12:07] ERROR    This is an error message\r\n    \u26d4 [10/04/25 14:12:07] WARNING  This is a warning message\r\n    \ud83d\udce2 [10/04/25 14:12:07] NOTICE   This is a notice message\r\n    \ud83d\udd14 [10/04/25 14:12:07] INFO     This is an info message\r\n    \ud83d\udc1b [10/04/25 14:12:07] DEBUG    This is a debug message\r\n\r\n>>> FORMAT = \"%(icon)s %(asctime)s - %(name)s - %(process)d - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)\"\r\n>>> logger = setup_logging(show_background=True, format_template=FORMAT, name=\"TEST\")\r\n>>> code = \"\"\"\r\n    def hello():\r\n        print(\"Hello World\")\r\n    \"\"\"\r\n>>> logger.info(code, lexer='python')\r\n>>> #output\r\n    \ud83d\udd14 [10/04/25 15:12:34] TEST 15448 INFO\r\n\r\n    def hello():\r\n        print(\"Hello World\")\r\n\r\n>>> logger.debug(\"SELECT * FROM users\", lexer=\"sql\")  # Syntax highlighted!\r\n>>> #output\r\n    \ud83d\udc1b [10/04/25 15:12:35] TEST 15448 DEBUG                                \r\n    SELECT * FROM users\r\n\r\n```\r\n\r\n### With Custom Format Template\r\n\r\n```python\r\ntemplate = \"%(asctime)s | %(levelname)s | %(name)s | %(funcName)s() | %(message)s\"\r\n\r\nlogger = setup_logging(\r\n    name=\"api\",\r\n    format_template=template,\r\n    show_background=False\r\n)\r\n\r\nlogger.notice(\"User logged in successfully \ud83d\udd11\")\r\n```\r\n\r\n### Custom Format Template + Icon in Template\r\n\r\n```python\r\nFORMAT = \"%(icon)s %(asctime)s - %(levelname)s - %(message)s (%(filename)s:%(lineno)d)\"\r\n\r\nlogger = setup_logging(\r\n    name=\"TEST\",\r\n    format_template=FORMAT,\r\n    icon_first=True,           # Icon always at start (overrides template position)\r\n    omit_repeated_times=True   # Hide repeated timestamps\r\n)\r\n\r\nlogger.info(\"Hello world\")\r\n# Output:\r\n# \ud83d\udd14 [10/06/25 15:30:00] INFO - Hello world (test.py:10)\r\n# \ud83d\udd14                     INFO - Another message (test.py:11)\r\n```\r\n\r\n### Show Level in Message (`level_in_message=True`)\r\n\r\n```python\r\nlogger = setup_logging(level_in_message=True)\r\nlogger.info(\"This is a message\")\r\n# Output: INFO - This is a message\r\n```\r\n\r\n### Simple Logger (No Rich, for Jupyter)\r\n\r\n```python\r\nfrom richcolorlog import setup_logging_custom\r\n\r\nlogger = setup_logging_custom(\r\n    name=\"notebook\",\r\n    show_icon=True,\r\n    icon_first=False,\r\n    show_background=False\r\n)\r\n\r\nlogger.info(\"Running analysis in Jupyter \ud83d\udcca\")\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udfaf Advanced Examples\r\n\r\n### \ud83d\udd0c Send Logs to Kafka & File Logging\r\n\r\n```python\r\nlogger = setup_logging(\r\n    name=\"producer\",\r\n    log_file=True,\r\n    log_file_name=\"app.log\",\r\n    kafka=True,\r\n    kafka_host=\"localhost\",\r\n    kafka_port=9092,\r\n    kafka_topic=\"app-logs\",\r\n    level=\"DEBUG\"\r\n)\r\n\r\nlogger.alert(\"Critical system event! \ud83d\udea8\")\r\n```\r\n\r\n### \ud83d\uddc4\ufe0f Log to PostgreSQL\r\n\r\n```python\r\nlogger = setup_logging(\r\n    db=True,\r\n    db_type=\"postgresql\",\r\n    db_host=\"localhost\",\r\n    db_name=\"logs\",\r\n    db_user=\"admin\",\r\n    db_password=\"secret\"\r\n)\r\n\r\nlogger.emergency(\"Database connection lost!\")\r\n```\r\n\r\n### \ud83c\udfa8 Custom Colors per Level\r\n\r\n```python\r\nlogger = setup_logging(\r\n    info_color=\"#00FFAA\",\r\n    error_color=\"bold red on #111111\",\r\n    warning_color=\"yellow\",\r\n    show_background=True\r\n)\r\nlogger.info(\"Custom color!\")\r\nlogger.error(\"Custom background!\")\r\n```\r\n\r\n### \ud83e\udde0 Custom Log Levels\r\n\r\n```python\r\nlogger.notice(\"New user registered \ud83d\udce2\")      # Custom level 25\r\nlogger.fatal(\"Fatal error \u2014 shutting down \ud83d\udc80\")  # Level 55\r\nlogger.alert(\"Immediate action required! \ud83d\udea8\")   # Level 59\r\n```\r\n\r\n### \ud83e\udde0 Custom Log Levels (Correct Location!)\r\n\r\n```python\r\n# File: test.py\r\nlogger = setup_logging(name=\"test\")\r\nlogger.emergency(\"System down!\")  # Shows: test.py:5 (not logger.py!)\r\n```\r\n\r\n```\r\nimport logging\r\nlogger = logging.getLogger(\"INHERITANCE\")\r\nfrom richcolorlog import RichColorLogHandler\r\nhandler = RichColorLogHandler()\r\nlogger.handlers.clear()\r\nlogger.addHandler(handler)\r\nlogger.propagate = False\r\n\r\nlogger.emergency(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\nlogger.alert(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\nlogger.critical(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\nlogger.error(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\nlogger.warning(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\nlogger.notice(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\nlogger.debug(\"RGBME v0.13.2 - 128x64 Matrix | 1x1 Chain | 12px per LED (REAL) | BrowserAdapter\")\r\n\r\n```\r\n---\r\n\r\n## \ud83d\udee0\ufe0f Configuration Options\r\n\r\n| Parameter | Description | Default |\r\n|----------|------------|--------|\r\n| `show_icon` | Show emoji icons | `True` |\r\n| `icon_first` | Icon before timestamp | `True` |\r\n| `format_template` | Log format (supports `%(icon)s`) | `None` |\r\n| `level_in_message` | Prefix message with `\"LEVEL - \"` | `False` |\r\n| `omit_repeated_times` | Hide repeated timestamps | `True` |\r\n| `show_background` | Enable background colors | `True` |\r\n| `..._color` | Custom color per level (`info_color`, `error_color`, etc.) | Default |\r\n| All `RichHandler` args | `tracebacks_show_locals`, `keywords`, `highlighter`, etc. | Fully supported |\r\n\r\n> \u2705 If `format_template` contains `%(icon)s`, the icon is **still controlled by `icon_first`** \u2014 no duplicates.\r\n\r\n---\r\n\r\n## \ud83e\udd9d Available Lexers\r\n\r\nYou can use any lexer supported by Pygments for syntax highlighting:\r\n\r\n- `\"python\"` - Python code\r\n- `\"javascript\"` - JavaScript code\r\n- `\"sql\"` - SQL queries  \r\n- `\"json\"` - JSON data\r\n- `\"yaml\"` - YAML configuration\r\n- `\"bash\"` - Shell scripts\r\n- And many more...\r\n\r\n## \ud83d\udc07 Custom Log Levels\r\n\r\nrichcolorlog adds several custom log levels above the standard CRITICAL level:\r\n\r\n| Level | Numeric Value | Description |\r\n|-------|---------------|-------------|\r\n| NOTICE | 55 | Informational messages |\r\n| ALERT | 60 | Alert conditions |\r\n| CRITICAL | 65 | Critical conditions |\r\n| FATAL | 70 | Fatal errors |\r\n| EMERGENCY | 75 | System is unusable |\r\n\r\n---\r\n\r\n## \ud83e\udde9 Supported Log Record Fields in Templates\r\n\r\nYou can use **any standard `LogRecord` field** in your `format_template`:\r\n\r\n```text\r\n%(asctime)s       \u2192 2025-10-03 14:30:00\r\n%(name)s          \u2192 myapp\r\n%(levelname)s     \u2192 INFO\r\n%(message)s       \u2192 Your log message\r\n%(filename)s      \u2192 app.py\r\n%(lineno)d        \u2192 42\r\n%(funcName)s      \u2192 main\r\n%(process)d       \u2192 12345\r\n%(thread)d        \u2192 67890\r\n%(module)s        \u2192 app\r\n%(pathname)s      \u2192 /path/to/app.py\r\n%(created)f       \u2192 1728000000.123\r\n%(msecs)d         \u2192 123\r\n%(relativeCreated)d \u2192 456\r\n%(processName)s   \u2192 MainProcess\r\n%(threadName)s    \u2192 Thread-1\r\n%(icon)s          \u2192 \ud83d\udc1e (auto-injected)\r\n```\r\n\r\n> \u2705 **Custom fields** from `extra={}` are also supported!\r\n\r\n---\r\n\r\n## \ud83c\udf10 Compatibility\r\n\r\n- \u2705 **Python 3.8+**\r\n- \u2705 **Jupyter Notebook / IPython** (auto-detects and disables async features)\r\n- \u2705 **Terminals** (Windows, macOS, Linux)\r\n- \u2705 **Docker / CI Environments** (falls back to ANSI if needed)\r\n\r\n---\r\n\r\n## \ud83d\udcda Why Use `richcolorlog`?\r\n\r\n| Feature | Standard `logging` | `rich` | `richcolorlog` |\r\n|--------|-------------------|--------|----------------|\r\n| Emoji Icons | \u274c | \u274c | \u2705 |\r\n| Custom Levels (`NOTICE`, `ALERT`) | \u274c | \u274c | \u2705 |\r\n| Syntax Highlighting | \u274c | \u274c | \u2705 |\r\n| Multi-Output (File + Kafka + DB) | Manual | \u274c | \u2705 |\r\n| Template + Icon | \u274c | Limited | \u2705 |\r\n| Accurate File/Line | \u2705 | \u274c | \u2705 |\r\n| Jupyter Safe | \u274c | \u26a0\ufe0f | \u2705 |\r\n| Repeated Timestamps | \u274c | \u2705 | \u2705 \r\n| Custom Format Templates | \u2705 | Limited | \u2705 + **icon support** |\r\n\r\n---\r\n\r\n## \ud83d\ude4f Acknowledgements\r\n\r\n- Built on top of [`rich`](https://github.com/Textualize/rich) by Will McGugan with ansi color Fallback if no rich installed  \r\n- Icons from [EmojiOne](https://emojione.com/)\r\n---\r\n\r\n## \ud83d\udcdc License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\nMIT \u00a9 [Hadi Cahyadi](https://github.com/cumulus13)\r\n\r\n---\r\n\r\n## \ud83d\udd17 Links\r\n\r\n- \ud83d\udce6 **PyPI**: https://pypi.org/project/richcolorlog/  \r\n- \ud83d\udcbb **GitHub**: https://github.com/cumulus13/richcolorlog  \r\n- \ud83d\udce7 **Author**: cumulus13@gmail.com\r\n\r\n---\r\n\r\n> \ud83d\udcac **Made with \u2764\ufe0f for developers who love beautiful, informative logs!**  \r\n> \u2b50 **Star the repo if you find it useful!**\r\n\r\n\r\n## author\r\n[Hadi Cahyadi](mailto:cumulus13@gmail.com)\r\n    \r\n\r\n[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)\r\n\r\n[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)\r\n \r\n[Support me on Patreon](https://www.patreon.com/cumulus13)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A beautiful and feature-rich logging package using Rich library",
    "version": "1.44.12",
    "project_urls": {
        "Bug Tracker": "https://github.com/cumulus13/richcolorlog/issues",
        "Documentation": "https://github.com/cumulus13/richcolorlog#readme",
        "Homepage": "https://github.com/cumulus13/richcolorlog",
        "Repository": "https://github.com/cumulus13/richcolorlog"
    },
    "split_keywords": [
        "logging",
        " rich",
        " console",
        " terminal",
        " colors",
        " formatting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f856ebc4b69d7a88bf5fafbe86d44afcbde250f46ca42d4ab434d7ae90d18c0",
                "md5": "7438876fa1d671d6b419dc1d3a6213f9",
                "sha256": "51bdf1a3cd189b3cdb2668023e264f6e8778cb3a85500fca6ef54fb6ddd12d2f"
            },
            "downloads": -1,
            "filename": "richcolorlog-1.44.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7438876fa1d671d6b419dc1d3a6213f9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 258074,
            "upload_time": "2025-10-06T18:48:46",
            "upload_time_iso_8601": "2025-10-06T18:48:46.840195Z",
            "url": "https://files.pythonhosted.org/packages/9f/85/6ebc4b69d7a88bf5fafbe86d44afcbde250f46ca42d4ab434d7ae90d18c0/richcolorlog-1.44.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a706cd17ae30041d8f95774bb8225daf66803557c91bd8d5c5731b05c8e98d1c",
                "md5": "5a1e738f822cac2a604703a887316f5d",
                "sha256": "fa8f61031d960f8db0c29b5bd60afa556da5019cdf55bb083a373f4757c01af0"
            },
            "downloads": -1,
            "filename": "richcolorlog-1.44.12.tar.gz",
            "has_sig": false,
            "md5_digest": "5a1e738f822cac2a604703a887316f5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 479132,
            "upload_time": "2025-10-06T18:48:50",
            "upload_time_iso_8601": "2025-10-06T18:48:50.448706Z",
            "url": "https://files.pythonhosted.org/packages/a7/06/cd17ae30041d8f95774bb8225daf66803557c91bd8d5c5731b05c8e98d1c/richcolorlog-1.44.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 18:48:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cumulus13",
    "github_project": "richcolorlog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "rich",
            "specs": [
                [
                    ">=",
                    "10.0.0"
                ]
            ]
        }
    ],
    "lcname": "richcolorlog"
}
        
Elapsed time: 1.27146s