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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fzutility-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f386dbd52ed18c9e5e304f31ffe792c0b2569986632c7f11949dcf0181013b35
MD5 02f3e4de3ebbbc8a4aa50b96bf42e8fb
BLAKE2b-256 c91cda2ef571a7b66c576cec27ab1216eb2a452441080c301c2f3050560520c1

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