Metadata-Version: 2.4
Name: onelogg
Version: 0.1.1
Summary: A lightweight Rich-based logging module
Author: BottiCelle
License: MIT License
        
        Copyright (c) 2026 BottiCelle
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/BottiCelle/onelog
Project-URL: Repository, https://github.com/BottiCelle/onelog
Project-URL: Issues, https://github.com/BottiCelle/onelog/issues
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rich<15,>=13
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# onelog 📝

**中文 | [English](README_en.md)**

基于 [Rich](https://github.com/textualize/rich) 的轻量级 Python 日志模块。

## 功能特性

- 🎨 终端彩色输出（WARNING=黄色，ERROR=红色，FATAL=紫色）
- 📁 可选文件日志（纯文本）
- 📍 显示文件名和行号（可开关）
- 📊 脚本退出时自动打印日志统计
- 💀 `log.fatal()` — 打印日志后立即退出脚本
- 🔧 多模块支持 — 顶层配置自动覆盖子模块

## 环境要求

- Python 3.8+
- 仅依赖 `rich`

```bash
python3 -m pip install onelogg
```

也可以直接从 GitHub 安装已标记的版本：

```bash
python3 -m pip install "git+https://github.com/BottiCelle/onelog.git@v0.1.1"
```

当前包版本为 `0.1.1`，发行名为 `onelogg`，导入名保持为
`onelog`。

## 使用方法

```python
from onelog import get_logger

# 顶层模块配置（第一个调用 get_logger 的决定全局配置）
log = get_logger(__name__, level="DEBUG", show_path=True, log_file="app.log")

log.debug("调试信息")
log.info("正常信息")
log.warning("警告信息")
log.error("错误信息")
log.fatal("致命错误，脚本将退出")
```

子模块不需要配置，直接用就行（自动继承顶层配置）：

```python
# finder.py
from onelog import get_logger

log = get_logger(__name__)

def find_data(query):
    log.debug(f"搜索: {query}")
    return []
```

## 日志统计

脚本退出时自动打印统计信息，无需手动调用：

```
──────────────────────────────── 📊 Log Summary ────────────────────────────────
  DEBUG:   1
  INFO:    1
  WARNING: 1
  ERROR:   1

  Log File: /path/to/app.log
────────────────────────────────────────────────────────────────────────────────
```

## License

MIT
