Skip to content

Commit

Permalink
small change to the log format
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Feb 28, 2024
1 parent d76041a commit ed19943
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 1 addition & 3 deletions matter_server/server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@


def _setup_logging() -> None:
log_fmt = (
"%(asctime)s.%(msecs)03d %(levelname)s (%(threadName)s) [%(name)s] %(message)s"
)
log_fmt = "%(asctime)s (%(threadName)s) %(levelname)s [%(name)s] %(message)s"
custom_level_style = {
**coloredlogs.DEFAULT_LEVEL_STYLES,
"chip_automation": {"color": "green", "faint": True},
Expand Down
11 changes: 8 additions & 3 deletions matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,12 @@ async def remove_node(self, node_id: int) -> None:
),
)
except ChipStackError as err:
LOGGER.warning("Removing current fabric from device failed.", exc_info=err)
LOGGER.warning(
"Removing current fabric from device failed: %s",
str(err),
# only log stacktrace if we have debug logging enabled
exc_info=err if LOGGER.isEnabledFor(logging.DEBUG) else None,
)
return
if (
result is None
Expand Down Expand Up @@ -719,7 +724,7 @@ async def ping_node(self, node_id: int) -> NodePingResult:

async def _do_ping(ip_address: str) -> None:
"""Ping IP and add to result."""
timeout = 30 if battery_powered else 5
timeout = 60 if battery_powered else 10
if "%" in ip_address:
# ip address contains an interface index
clean_ip, interface_idx = ip_address.split("%", 1)
Expand Down Expand Up @@ -1183,7 +1188,7 @@ def _on_mdns_operational_node_state(
# so we debounce this as we only use the mdns messages for operational node discovery
# and we have other logic in place to determine node aliveness
last_seen = self._node_last_seen.get(node_id, 0)
if node.available and time.time() - last_seen < MIN_NODE_SUBSCRIPTION_CEILING:
if node.available and time.time() - last_seen < MAX_NODE_SUBSCRIPTION_CEILING:
return

# we treat UPDATE state changes as ADD if the node is marked as
Expand Down

0 comments on commit ed19943

Please sign in to comment.