diff --git a/hbmqtt/utils.py b/hbmqtt/utils.py index dd92469..161d07c 100644 --- a/hbmqtt/utils.py +++ b/hbmqtt/utils.py @@ -13,4 +13,11 @@ def not_in_dict_or_none(dict, key): if key not in dict or dict[key] is None: return True else: - return False \ No newline at end of file + return False + + +def format_client_message(session=None, address=None, port=None, id=None): + if session: + return "(client @=%s:%d id=%s)" % (session.remote_address, session.remote_port, session.client_id) + else: + return "(client @=%s:%d id=%s)" % (address, port, id)