Skip to content

Commit

Permalink
Fixed log levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanU committed Nov 15, 2023
1 parent 28ff39f commit ceec3d9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions custom_components/mygekko/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.data.setdefault(DOMAIN, {})
_LOGGER.info(STARTUP_MESSAGE)

_LOGGER.info("Testlog: async_setup_entry")

_LOGGER.debug("async_setup_entry")
pymygekko_logger: logging.Logger = logging.getLogger("PyMyGekko")
log_level: int = _LOGGER.getEffectiveLevel()
pymygekko_logger.setLevel(log_level)
Expand All @@ -52,18 +51,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

session = async_get_clientsession(hass)

_LOGGER.info("Testlog: async_setup_entry: MyGekkoApiClient creation")
client = MyGekkoApiClient(username, apikey, gekkoid, session)

_LOGGER.info("Testlog: async_setup_entry: MyGekkoDataUpdateCoordinator creation")
coordinator = MyGekkoDataUpdateCoordinator(hass, client=client)
_LOGGER.info(
"Testlog: async_setup_entry: MyGekkoDataUpdateCoordinator async_refresh"
)
await coordinator.async_refresh()

if not coordinator.last_update_success:
_LOGGER.info("Testlog: async_setup_entry: ConfigEntryNotReady")
_LOGGER.exception("async_refresh failed")
raise ConfigEntryNotReady

hass.data[DOMAIN][entry.entry_id] = coordinator
Expand Down Expand Up @@ -95,11 +89,11 @@ def __init__(

async def _async_update_data(self):
"""Update data via library."""
_LOGGER.info("Testlog: _async_update_data ")
_LOGGER.debug("_async_update_data ")
try:
return await self.api.read_data()
except Exception as exception:
_LOGGER.info("Testlog: _async_update_data failed", exception)
_LOGGER.exception("_async_update_data failed")
raise UpdateFailed() from exception


Expand Down

0 comments on commit ceec3d9

Please sign in to comment.