Skip to content

Commit

Permalink
pass through _LOGGER
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Jan 4, 2025
1 parent 9a2e4d9 commit d374a85
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/evohome/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(
self._hostname: Final = _hostname or HOSTNAME
self.logger = logger or logging.getLogger(__name__)

self._was_authenticated = False # True once credentials are proven validated
self._was_authenticated = False # True once credentials are proven valid

def __str__(self) -> str:
"""Return a string representation of the object."""
Expand Down
8 changes: 7 additions & 1 deletion src/evohomeasync/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import logging
from abc import ABC, abstractmethod
from datetime import UTC, datetime as dt, timedelta as td
from typing import TYPE_CHECKING, Any, Final, TypedDict
Expand All @@ -21,7 +22,6 @@
from .schemas import TCC_POST_USR_SESSION

if TYPE_CHECKING:
import logging
from collections.abc import Awaitable, Callable

import aiohttp
Expand All @@ -30,6 +30,9 @@
from .schemas import EvoSessionDictT, EvoUserAccountDictT, TccSessionResponseT


_LOGGER = logging.getLogger(__name__.rpartition(".")[0])


# For API docs, enter this App ID on the following website under 'Session login':
# - https://mytotalconnectcomfort.com/WebApi/Help/LogIn
_APPLICATION_ID: Final = "91db1612-73fd-4500-91b2-e63b069b185c"
Expand Down Expand Up @@ -70,6 +73,9 @@ def __init__(
) -> None:
"""Initialise the session manager."""

if logger is None:
logger = _LOGGER

super().__init__(
client_id, secret, websession, _hostname=_hostname, logger=logger
)
Expand Down
2 changes: 1 addition & 1 deletion src/evohomeasync/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
self.logger = _LOGGER
if debug:
self.logger.setLevel(logging.DEBUG)
self.logger.debug("Debug mode is explicitly enabled.")
self.logger.debug("Debug mode explicitly enabled via kwarg.")

self._session_manager = session_manager

Expand Down
8 changes: 7 additions & 1 deletion src/evohomeasync2/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import base64
import logging
from abc import ABC, abstractmethod
from datetime import UTC, datetime as dt, timedelta as td
from http import HTTPStatus
Expand All @@ -22,7 +23,6 @@
from . import exceptions as exc

if TYPE_CHECKING:
import logging
from collections.abc import Awaitable, Callable

import aiohttp
Expand All @@ -34,6 +34,9 @@
)


_LOGGER = logging.getLogger(__name__.rpartition(".")[0])


_APPLICATION_ID: Final = base64.b64encode(
b"4a231089-d2b6-41bd-a5eb-16a0a422b999:" # fmt: off
b"1a15cdb8-42de-407b-add0-059f92c530cb"
Expand Down Expand Up @@ -95,6 +98,9 @@ def __init__(
) -> None:
"""Initialize the token manager."""

if logger is None:
logger = _LOGGER

super().__init__(
client_id, secret, websession, _hostname=_hostname, logger=logger
)
Expand Down
2 changes: 1 addition & 1 deletion src/evohomeasync2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
self.logger = _LOGGER
if debug:
self.logger.setLevel(logging.DEBUG)
self.logger.debug("Debug mode is explicitly enabled.")
self.logger.debug("Debug mode explicitly enabled via kwarg.")

self._token_manager = token_manager

Expand Down

0 comments on commit d374a85

Please sign in to comment.