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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fzutility-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c19c494c4433a56ca69f57ec14a61c345676cc33b64fc773cc1707b944860390
MD5 9f0b9a324322b00bac840529ea0976a3
BLAKE2b-256 a6af05955fd912fb424316860299239fce882019d0087dd76d470c95fc364492

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