Skip to main content

python client for https://github.com/ausward/QTLogs

Project description

QT Py Logs

A Python client for publishing log messages to an MQTT broker, designed to work with the QTLogs project. This package provides a simple, singleton logger that can be used across a Python application to send structured log messages to a specified MQTT topic.

Installation

Install the package using poetry:

poetry add qt-py-logs

Or using pip:

pip install qt-py-logs

Usage

First, set up the logger with your MQTT broker details. This only needs to be done once per application.

from qt_py_logs import SetupLogger

logger = SetupLogger(
    topic="your/mqtt/topic",
    broker="your_mqtt_broker.com",
    port=1883,
    source="your_application_name"
)

Then, you can use the logger instance to log messages from anywhere in your application:

from qt_py_logs import QTlogger

# Get the logger instance
logger = QTlogger()

# Log a message
logger.log("INFO", "This is an informational message.")
logger.log("ERROR", "This is an error message.")

# If you want to add additional fields to the log message
extra_data = {"user_id": 1234, "operation": "data_processing"}
logger.log("DEBUG", "This is a debug message with extra data.", Extra=extra_data)

The log messages will be published to the specified MQTT topic in a JSON format:

{
    "from": "your_application_name",
    "payload": "This is an informational message.",
    "level": "INFO",
    "timestamp": "2025-11-24 10:00:00",
    "caller": "your_function_name"
}

License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. See the LICENSE file for details.

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

qt_py_logs-0.1.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

qt_py_logs-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file qt_py_logs-0.1.3.tar.gz.

File metadata

  • Download URL: qt_py_logs-0.1.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Darwin/25.1.0

File hashes

Hashes for qt_py_logs-0.1.3.tar.gz
Algorithm Hash digest
SHA256 45d37bda6822c6fb73e158bc34d3cba9447af007d31046c8c6a917bf96a3e943
MD5 b4792325434b025ff348ea952cb627cf
BLAKE2b-256 e3ebd6f6e94b3e8c61cfa155654c6cc8db7b4337011310d3e96146ec57d5b4f4

See more details on using hashes here.

File details

Details for the file qt_py_logs-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: qt_py_logs-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Darwin/25.1.0

File hashes

Hashes for qt_py_logs-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ec36501acadfe7920bf0e2590250aa439368fe8c72e863a6807251aee4d08bc2
MD5 e3302d67ed660b81ce66e3a4d1cd5dc2
BLAKE2b-256 19a4b3b86a22d037d3353bf841e0c9f536ff01a8e780bd94643b53d6d0d66735

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