Skip to main content

Gelf kafka logger

Project description

py_kafka_logger

Gelf logger

config example:

kafka_logger:
  app_name: "app_name"
  bootstrap_servers:
    - "serv1:9092"
  topic: "log_topic"

usage:

from pathlib import Path

import yaml
import kafka_logger.kafka_logger

path = Path(__file__).resolve().parent / "config.yaml"
with path.open("r", encoding="utf-8") as handle:
    raw_config = (yaml.safe_load(handle) or {"kafka_logger": {}}).get("kafka_logger")
    settings = kafka_logger.kafka_logger.KafkaLoggerSettings(**raw_config)

kafka_logger.kafka_logger.KafkaLogger.init_producer(settings)

kl = kafka_logger.kafka_logger.KafkaLogger("test_service")

kl.info( "test_message", {"test_context": "text_value"})

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

py_kafka_logger-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

py_kafka_logger-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file py_kafka_logger-0.1.0.tar.gz.

File metadata

  • Download URL: py_kafka_logger-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for py_kafka_logger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2eae1987a3d14d9f38e7ebb0bd7a92e76560e83de9f75c8f67cad9228bf2a7b5
MD5 047c667fff1070d37ed964b81a341949
BLAKE2b-256 41ae32de71a3cb323710c3a2b1f5bdbdeba8d011e349d2308ddd369e075a415c

See more details on using hashes here.

File details

Details for the file py_kafka_logger-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_kafka_logger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f21200e626e8da9674db22bc6c418f0ba887f2cc4b8b1db28c4cb009ef8ee6c
MD5 958f81af40b647b937bfd3f858589602
BLAKE2b-256 d4243911e4c56ea4b88915172715da846261f205b704e9f94767d39bc4b77f89

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