Skip to main content

fzutility is a package that provides various utilities for python programming.

Project description

Funzin VC solution team Utils packages

How to use

Logger

To use the logger package, follow these steps:

  1. Import the logger module:

    from fz_logger.fz_logger import Logger
    
  2. Create a Logger object in class:

    class template(Logger):
        def __init__(self):
            super().__init__(level=config["logger"]["level"], save_path=config["logger"]["save_path"])
        ...
    
    self.logger.debug("This is a debug message")
    self.logger.info("This is an info message")
    self.logger.warning("This is a warning message")
    self.logger.error("This is an error message")
    self.logger.critical("This is a critical message")
    
  3. Create a Logger object in not class:

    logger = Logger(level="INFO", save_path="app-logs").logger
    ...
    
    logger.debug("This is a debug message")
    logger.info("This is an info message")
    logger.warning("This is a warning message")
    logger.error("This is an error message")
    logger.critical("This is a critical message")
    

MQTT

This module provides a MQTT client implementation. follow these steps:

  1. Import the mqttc lient module:

    from fz_mqtt.fz_mqtt import MqttClient
    
  2. Create a MqttClient object in class:

    config = {
        "mqtt": {
            "id": "mqtt_id"
            "pw": "mqtt_pw"
            "host": "mqtt_host"
            "port": 1883
            "qos": 1
            "pub-topic": "insert your topic"
            "sub-topic": "insert your topic"
        }
    }
    mqtt_client = MqttTools(config=config)
    
  3. Publish message

    self.mqtt_client.pub_message(
        topic=config["mqtt"]["pub-topic"],
        msg="your message,
    )
    
  4. Subscribe message

    import threading
    sub_mqtt = MqttServerClient(config=opt)
    
    subscriber_th = threading.Thread(target=sub_mqtt.sub_message, daemon=True)
    subscriber_th.start()
    

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

fzutility-1.0.5-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file fzutility-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: fzutility-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for fzutility-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eaec9b43310f4202bf085829000ffbb5d6d4c984fadf329d56d722c5d2d14c9e
MD5 e47ddc3e4b3cdd25e0598a17ff3f23bc
BLAKE2b-256 6aae4513a7e8614d295cf59ccd2bfcc1cfbb8a48602781ba320739fd290ccfc8

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