Skip to content

Commit

Permalink
Update logger to use filename instead of package and add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
amosyuen committed Feb 3, 2023
1 parent 2f46d86 commit fc025e4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"python.linting.pylintArgs": ["--rcfile=setup.cfg"],
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "venv/bin/python",
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tplink_deco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from .coordinator import TpLinkDecoData
from .coordinator import TplinkDecoUpdateCoordinator

_LOGGER: logging.Logger = logging.getLogger(__package__)
_LOGGER: logging.Logger = logging.getLogger(__name__)


async def async_create_and_refresh_coordinators(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tplink_deco/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

PKCS1_v1_5_HEADER_BYTES = 11

_LOGGER: logging.Logger = logging.getLogger(__package__)
_LOGGER: logging.Logger = logging.getLogger(__name__)


def byte_len(n: int) -> int:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tplink_deco/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .const import DEFAULT_SCAN_INTERVAL
from .const import DOMAIN

_LOGGER: logging.Logger = logging.getLogger(__package__)
_LOGGER: logging.Logger = logging.getLogger(__name__)


def _get_auth_schema(data: dict[str:Any]):
Expand Down
6 changes: 5 additions & 1 deletion custom_components/tplink_deco/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .const import SIGNAL_CLIENT_ADDED
from .const import SIGNAL_DECO_ADDED

_LOGGER: logging.Logger = logging.getLogger(__package__)
_LOGGER: logging.Logger = logging.getLogger(__name__)


def bytes_to_bits(bytes_count):
Expand Down Expand Up @@ -178,6 +178,7 @@ async def _async_update_data(self):
deco_added = True
deco = TpLinkDeco(mac)
deco.update(new_deco)
_LOGGER.debug("_async_update_data: Found new deco mac=%s", deco.mac)
else:
deco.update(new_deco)
decos[mac] = deco
Expand Down Expand Up @@ -257,6 +258,9 @@ async def _async_update_data(self):
if client is None:
client_added = True
client = TpLinkDecoClient(client_mac)
_LOGGER.debug(
"_async_update_data: Found new client mac=%s", client.mac
)
client.update(deco_client, deco_mac, utc_point_in_time)
clients[client_mac] = client

Expand Down
4 changes: 3 additions & 1 deletion custom_components/tplink_deco/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from .coordinator import TplinkDecoClientUpdateCoordinator
from .coordinator import TplinkDecoUpdateCoordinator

_LOGGER: logging.Logger = logging.getLogger(__package__)
_LOGGER: logging.Logger = logging.getLogger(__name__)


async def async_setup_entry(
Expand All @@ -69,6 +69,7 @@ def add_untracked_decos():
if mac in tracked_decos:
continue

_LOGGER.debug("add_untracked_decos: Adding deco mac=%s", deco.mac)
new_entities.append(TplinkDecoDeviceTracker(coordinator, deco))
tracked_decos.add(mac)

Expand All @@ -95,6 +96,7 @@ def add_untracked_clients():
if mac in tracked_clients:
continue

_LOGGER.debug("add_untracked_clients: Adding client mac=%s", client.mac)
new_entities.append(
TplinkDecoClientDeviceTracker(
coordinator_decos, coordinator_clients, client
Expand Down

0 comments on commit fc025e4

Please sign in to comment.