Metadata-Version: 2.4
Name: LogVictoriaLogs
Version: 0.1.2
Summary: Python client for VictoriaLogs integration
Home-page: https://github.com/yourusername/LogVictoriaLogs
Author: Author
Author-email: Author <author@example.com>
License: MIT License
        
        Copyright (c) 2025 LogVictoriaLogs
        
        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/yourusername/LogVictoriaLogs
Project-URL: Bug Tracker, https://github.com/yourusername/LogVictoriaLogs/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# LogVictoriaLogs

Python client library for integrating with VictoriaLogs, a high-performance log database and search solution.

## Features

- Easy integration with VictoriaLogs
- Support for multiple logging protocols (HTTP, Syslog)
- Automatic caller information capture
- Python logging module integration
- Structured logging with rich context information

## Installation

```bash
pip install LogVictoriaLogs
```

## Usage

### Basic Usage

```python
# ----------------------------------------------------------------------
# 🎯 示例
# ----------------------------------------------------------------------
def demo_function():
    # 初始化主客户端，只包含基础配置
    base_client = VictoriaLogsClient("192.168.164.31", project="shortlink-system")
    # 创建服务特定的客户端
    service_client = base_client.create_client("shortlink-updater")
    service_client.sent("从 demo_function 发出的日志")


if __name__ == "__main__":
    # 初始化主客户端，只包含基础配置
    base_client = VictoriaLogsClient("192.168.164.31", project="shortlink-system")
    
    # 为不同服务创建子客户端
    main_client = base_client.create_client("main")
    updater_client = base_client.create_client("shortlink-updater")

    # 模拟模块日志
    demo_function()
    main_client.sent("主模块启动完成")
    updater_client.sent("短链更新成功")

    # 查询
    main_client.print_logs('project:"shortlink-system" service:"shortlink-updater"')

```

### Python Logging Integration

```python
import logging
from LogVictoriaLogs import VictoriaLogsClient

# Create client
client = VictoriaLogsClient("victorialogs-host", 9428, 514)

# Configure logging
logger = logging.getLogger("MyApp")
logger.setLevel(logging.INFO)

# Add VictoriaLogs handler
handler = client.setup_logging_handler(service="my-application")
logger.addHandler(handler)

# Use standard logging
logger.info("Application started")
logger.error("Something went wrong")
```

## License

MIT
