diff --git a/ina219.py b/ina219.py index 5bfb2fd..bf79f28 100644 --- a/ina219.py +++ b/ina219.py @@ -124,8 +124,8 @@ def __init__(self, shunt_ohms, i2c, max_expected_amps=None, log_level -- set to logging.DEBUG to see detailed calibration calculations (optional). """ - logging.basicConfig(level=log_level) self._log = logging.getLogger("ina219") + self._log.setLevel(log_level) self._i2c = i2c self._address = address self._shunt_ohms = shunt_ohms @@ -406,7 +406,7 @@ def __read_register(self, register, negative_value_supported=False): def __log_register_operation(self, msg, register, value): # performance optimisation - if logging._level == logging.DEBUG: + if self._log.level == logging.DEBUG: binary = '{0:#018b}'.format(value) self._log.debug("%s register 0x%02x: 0x%04x %s", msg, register, value, binary)