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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fzutility-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e4575fa4997febc7edc32ea92c8fae234a4e455b2c0e6f3f0b6f408f35143fcf
MD5 b0a37022e1c4f0bbc0743e2102df698e
BLAKE2b-256 df716fc68463513570be5f7db65ad812aba3490056d412602f36e464ec94e303

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