Skip to content

Commit

Permalink
get rid of separate logger init function
Browse files Browse the repository at this point in the history
also document the self.logger
  • Loading branch information
vladak committed Feb 15, 2023
1 parent f072084 commit dd56de3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def __init__(
self._msg_size_lim = MQTT_MSG_SZ_LIM
self._pid = 0
self._timestamp = 0
self._init_logger()
self.logger = NullLogger()
"""An optional logging attribute that can be set with with a Logger
to enable debug logging."""

self._reconnect_attempt = 0
self._reconnect_timeout = float(0)
Expand Down Expand Up @@ -1177,8 +1179,4 @@ def enable_logger(self, log_pkg, log_level=20, logger_name="log"):

def disable_logger(self):
"""Disables logging."""
self._init_logger()

def _init_logger(self):
"""Initializes logger to NullLogger, i.e. no logging will be done."""
self.logger = NullLogger()

0 comments on commit dd56de3

Please sign in to comment.