Skip to main content

A loguru handler to send logs to Tencent Cloud CLS via Kafka

Project description

loguru-to-cls

A simple package to send loguru logs to Tencent Cloud CLS (Cloud Log Service) using the Kafka protocol.

Installation

From PyPI (Official)

If you just published the package, it might take a few minutes to sync to mirrors. Use the official PyPI server to install immediately:

pip install loguru-to-cls-tencent -i https://pypi.org/simple

Gitee (Source)

Or install from source:

pip install .

Usage

from loguru import logger
from loguru_to_cls import setup_cls_logging

# Initialize CLS logging
secret_id = "YOUR_SECRET_ID"
secret_key = "YOUR_SECRET_KEY"
logset_id = "YOUR_LOGSET_ID"
topic_id = "YOUR_TOPIC_ID"

handler = setup_cls_logging(secret_id, secret_key, logset_id, topic_id)

# Now you can use loguru as usual
logger.info("This is a test log message sent to Tencent Cloud CLS!")
logger.error("This is an error message.")

# Ensure all logs are sent before exiting
handler.flush()

Configuration

The setup_cls_logging function accepts the following parameters:

  • secret_id: Tencent Cloud Secret ID.
  • secret_key: Tencent Cloud Secret Key.
  • logset_id: CLS Logset ID.
  • topic_id: CLS Topic ID.
  • level: Logging level (default: "INFO").
  • bootstrap_servers: List of Kafka bootstrap servers (default: Tencent Cloud Guangzhou region).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loguru_to_cls_tencent-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loguru_to_cls_tencent-0.1.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file loguru_to_cls_tencent-0.1.2.tar.gz.

File metadata

  • Download URL: loguru_to_cls_tencent-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for loguru_to_cls_tencent-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3da6d7cf0ac0bb25164c5f6b5299bc8155d22dd18e9b6751de712e54d6d05834
MD5 bac47a9b73c86cdb9bc0532391adb7b4
BLAKE2b-256 f9389b5f9f933a7c614803d95e079979eeb8583f2a37ce6aa3530a8697a773c3

See more details on using hashes here.

File details

Details for the file loguru_to_cls_tencent-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for loguru_to_cls_tencent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e288e0b872510110337dc1ceded2440c1e73f74f9202f5bc7385e39e9c3966ab
MD5 c6b5ea8356d76a0756a12c5332879048
BLAKE2b-256 bcc69ce7bcb52862d1af10696bf616814f4fe1a3401f50cf0eeb340984105791

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page