semvec/pypi-packages huggingface dataset:
aliyun-log-fastpb 0.2.0
Fast protobuf serialization for Aliyun Log using PyO3 and quick-protobuf
License: MIT
Requires Python: >=3.7
Keywords: aliyun, protobuf, log, sls, performance

# aliyun-log-fastpb

[中文文档](README_CN.md) | English

[![Test](https://github.com/aliyun/aliyun-log-python-fastpb/actions/workflows/test.yml/badge.svg)](https://github.com/aliyun/aliyun-log-python-fastpb/actions/workflows/test.yml)

Fast protobuf serialization for Aliyun Log using PyO3 and quick-protobuf.

## Installation

```bash
pip install aliyun-log-fastpb
```

## Quick Start

```python
import aliyun_log_fastpb

# Prepare log data
log_group = {
    "LogItems": [
        {
            "Time": 1234567890,
            "Contents": [
                {"Key": "level", "Value": "INFO"},
                {"Key": "message", "Value": "Application started"}
            ]
        }
    ],
    "LogTags": [
        {"Key": "hostname", "Value": "server-001"}
    ],
    "Topic": "app-logs",
    "Source": "192.168.1.100"
}

# Serialize to protobuf bytes
pb_bytes = aliyun_log_fastpb.serialize_log_group(log_group)
```

For binary data support, use `serialize_log_group_raw`:

```python
log_group_raw = {
    "LogItems": [
        {
            "Time": 1234567890,
            "Contents": [
                {"Key": "data", "Value": b"\x00\x01\x02\xff"}
            ]
        }
    ],
    "LogTags": [],
    "Topic": "binary-logs",
    "Source": ""
}

pb_bytes = aliyun_log_fastpb.serialize_log_group_raw(log_group_raw)
```

For nanosecond precision timestamps, use `TimeNs` field:

```python
log_group = {
    "LogItems": [
        {
            "Time": 1234567890,
            "TimeNs": 123456789,  # Nanosecond precision
            "Contents": [
                {"Key": "event", "Value": "transaction_completed"}
            ]
        }
    ],
    "LogTags": [],
    "Topic": "transactions",
    "Source": ""
}

pb_bytes = aliyun_log_fastpb.serialize_log_group(log_group)
```

## License

MIT License
logship-client 0.1.1
A unified logging client that ships logs to Elasticsearch with async buffering.
License: MIT
Requires Python: >=3.8
Keywords: logging, elasticsearch, log, async, python, sdk

# Logship – Python Logging Client for Elasticsearch

`Logship` 是一个轻量级、可扩展的 Python 日志上报客户端，用于将结构化日志批量、异步推送到 Elasticsearch。

## Features

- 异步发送
- 批量缓冲
- 自动重试
- 支持 Basic Auth
- 自动创建索引（可选）
- 最小依赖

## Installation

```bash
pip install logship-client
```

## Quick Start

```python
from logship import LogshipClient

client = LogshipClient(
    base_url="https://your-es-server.com",
    index_prefix="logship",
    username="elastic",
    password="your_password",
    app_name="order-service",
    env="prod",
)

client.info("用户登录成功", user_id=123)
```

## Advanced Usage

```python
client.debug("查询订单", order_id=9981, cost_ms=12)
client.error("订单支付失败", order_id=9981, code="PAY_TIMEOUT")
```

## Directory Structure

```
logship/
├── es_logger
│   ├── __init__.py
│   ├── config.py
│   ├── handler.py
│   └── setup.py
├── README.md
├── pyproject.toml
└── LICENSE
```

## License

MIT License