semvec/pypi-packages huggingface dataset:
telecom-channel-log 1.2
专为电渠应用服务设计的高效日志库，支持多级别日志记录、日志轮转、流水日志追踪及埋点日 志功能，深度集成 Flask 和 Requests 框架。
License: MIT
Requires Python: >=2.7

# telecom-channel-log

[![Release](https://img.shields.io/github/release/2018-11-27/telecom-channel-log.svg?style=flat-square")](https://github.com/2018-11-27/telecom-channel-log/releases/latest)
[![Python Version](https://img.shields.io/badge/python-2.7+/3.6+-blue.svg)](https://github.com/gqylpy/gqylpy-log)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://pepy.tech/badge/telecom-channel-log)](https://pepy.tech/project/telecom-channel-log)

专为电渠应用服务设计的高效日志库，支持多级别日志记录、日志轮转、流水日志追踪及埋点日志功能，深度集成 Flask 和 Requests 框架。

## 主要特性

- 📅 支持按时间轮转日志（天/小时/分钟等）
- 📊 提供多级别日志记录（DEBUG/INFO/WARNING/ERROR）
- 🌐 内置Flask中间件记录请求/响应流水日志（Journallog-in）
- 📡 集成Requests会话记录外部调用流水日志（Journallog-out）
- 🔍 智能处理长字符串截断（超过1000字符自动标记）
- 📁 自动创建分级日志目录结构
- 💻 支持终端输出与文件存储分离控制

## 安装

```bash
pip install telecom-channel-log
```

## 快速入门

### 基础配置

```python
# coding:utf-8
import telecom_channel_log as log

# 初始化日志配置
log.__init__("<your_appname>", "<your_syscode>", logdir="/app/logs")

# 初始化后可直接调用日志方法，日志将记录到参数 `logdir` 指定的目录中
log.debug("调试信息", extra_field="value")
log.info("业务日志", user_id=123)
log.warning("异常预警", error_code=500)
log.error("系统错误", stack_trace="...")

# 埋点日志
log.trace(
    user_id=123,
    action="purchase",
    item_count=2
)
```

### Flask 流水日志

```python
# coding:utf-8
import telecom_channel_log as log

# 初始化日志配置
log.__init__(..., enable_journallog_in=True)
```

设置 `enable_journallog_in=True` 表示启用 Flask 流水日志，将自动记录每个接口的调用信息。

### Requests 外部调用追踪

```python
# coding:utf-8
import telecom_channel_log as log

# 初始化日志配置
log.__init__(..., enable_journallog_out=True)
```

设置 `enable_journallog_out=True` 表示启用 Requests 外部调用追踪，将自动记录每个请求的调用信息。

## 详细配置

### 初始化参数

| 参数名                   | 类型   | 默认值      | 说明                            |
|-----------------------|------|----------|-------------------------------|
| appname               | str  | 必填       | 应用名称，建议与CI配置一致                |
| syscode               | str  | 必填       | 系统编码（大写）                      |
| logdir                | str  | 系统相关默认路径 | 日志存储根目录                       |
| when                  | str  | 'D'      | 轮转周期：W(周)/D(天)/H(时)/M(分)/S(秒) |
| interval              | int  | 1        | 轮转频率                          |
| backup_count          | int  | 7        | 历史日志保留数量（0=永久）                |
| output_to_terminal    | bool | False    | 启用后日志将同时输出到控制台                |
| enable_journallog_in  | bool | False    | 启用Flask请求流水日志                 |
| enable_journallog_out | bool | False    | 启用Requests外部调用日志              |
natal-report 0.1.6
generate PDF report for the Natal package
License: MIT
Requires Python: >=3.12

# PDF Report for the Natal Package

[![ci-badge]][ci-url] [![pypi-badge]][pypi-url] [![MIT-badge]][MIT-url] [![black-badge]][black-url]

> generate PDF report for the [Natal] package

## Installation

- dependencies:
  - [Natal]: for natal chart data and SVG paths
  - [weasyprint]: PDF generation
    - refer weasyprint docs for installing OS dependencies
    - you may need to install [Pango] for text rendering

`pip install natal-report`

or install as optional dependency of [Natal]:

`pip install "natal[report]"`

## Usage

```python
from natal import Data, Config
from natal.config import Orb
from natal_report import Report

config = Config(
    theme_type="mono",
    orb=Orb(conjunction=2, opposition=2, trine=2, square=2, sextile=1),
)

mimi = Data(
    name="Mimi",
    utc_dt="1980-02-23 00:00",
    lat=25.0375,
    lon=121.5633,
    config=config,
)

transit = Data(
    name="transit",
    utc_dt="2024-12-21 00:00",
    lat=25.0375,
    lon=121.5633,
)

report = Report(data1=mimi, data2=transit)
html = report.full_report
bytes_io = report.create_pdf(html)

with open("demo_report_mono.pdf", "wb") as f:
    f.write(bytes_io.getbuffer())
```

- see [demo_report_light.pdf] for light theme with Birth Chart
- see [demo_report_mono.pdf] for mono theme with Transit Chart

[black-badge]: https://img.shields.io/badge/formatter-Black-black
[black-url]: https://github.com/psf/black
[ci-badge]: https://github.com/hoishing/natal-report/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/hoishing/natal-report/actions/workflows/ci.yml
[demo_report_light.pdf]: https://github.com/hoishing/natal-report/blob/main/demo_report_light.pdf
[demo_report_mono.pdf]: https://github.com/hoishing/natal-report/blob/main/demo_report_mono.pdf
[MIT-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[MIT-url]: https://github.com/hoishing/natal-report/blob/main/LICENSE
[Natal]: https://github.com/hoishing/natal
[Pango]: https://gitlab.gnome.org/GNOME/pango
[pypi-badge]: https://img.shields.io/pypi/v/natal-report
[pypi-url]: https://pypi.org/project/natal-report
[weasyprint]: https://doc.courtbouillon.org/weasyprint/stable/