Skip to content

Commit

Permalink
Remove debug logging check
Browse files Browse the repository at this point in the history
Unless this is hyper optimization this check done inside the log.
https://github.com/python/cpython/blob/3.12/Lib/logging/__init__.py#L1517
  • Loading branch information
Siecje committed Jun 24, 2024
1 parent 5d6d145 commit 34c9861
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 2 additions & 4 deletions bleak/backends/bluezdbus/advertisement_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ def Activate(self):
@method()
@no_type_check
def DeviceFound(self, device: "o"): # noqa: F821
if logger.isEnabledFor(logging.DEBUG):
logger.debug("DeviceFound %s", device)
logger.debug("DeviceFound %s", device)

@method()
@no_type_check
def DeviceLost(self, device: "o"): # noqa: F821
if logger.isEnabledFor(logging.DEBUG):
logger.debug("DeviceLost %s", device)
logger.debug("DeviceLost %s", device)

@dbus_property(PropertyAccess.READ)
@no_type_check
Expand Down
18 changes: 8 additions & 10 deletions bleak/backends/bluezdbus/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ async def async_init(self) -> None:
desc_props["Characteristic"], set()
).add(path)

if logger.isEnabledFor(logging.DEBUG):
logger.debug("initial properties: %s", self._properties)
logger.debug("initial properties: %s", self._properties)

except BaseException:
# if setup failed, disconnect
Expand Down Expand Up @@ -876,14 +875,13 @@ def _parse_msg(self, message: Message) -> None:
if message.message_type != MessageType.SIGNAL:
return

if logger.isEnabledFor(logging.DEBUG):
logger.debug(
"received D-Bus signal: %s.%s (%s): %s",
message.interface,
message.member,
message.path,
message.body,
)
logger.debug(
"received D-Bus signal: %s.%s (%s): %s",
message.interface,
message.member,
message.path,
message.body,
)

# type hints
obj_path: str
Expand Down

0 comments on commit 34c9861

Please sign in to comment.