From 83a8eb8dd2d0a8e7734ea47f8c186f762d6a57ff Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Fri, 5 Jun 2020 06:27:23 +0300 Subject: proper logs --- kvmd/apps/ipmi/server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'kvmd/apps/ipmi') diff --git a/kvmd/apps/ipmi/server.py b/kvmd/apps/ipmi/server.py index 084656de..ede6d786 100644 --- a/kvmd/apps/ipmi/server.py +++ b/kvmd/apps/ipmi/server.py @@ -88,8 +88,8 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute except (aiohttp.ClientError, asyncio.TimeoutError): session.send_ipmi_response(code=0xFF) except Exception: - get_logger(0).exception("Unexpected exception while handling IPMI request: netfn=%d; command=%d", - request["netfn"], request["command"]) + get_logger(0).exception("[%s]: Unexpected exception while handling IPMI request: netfn=%d; command=%d", + session.sockaddr[0], request["netfn"], request["command"]) session.send_ipmi_response(code=0xFF) else: session.send_ipmi_response(code=0xC1) @@ -121,14 +121,14 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute async def runner(): # type: ignore logger = get_logger(0) credentials = self.__auth_manager.get_credentials(session.username.decode()) - logger.info("Client %s: Performing request %s from user %r (IPMI) as %r (KVMD)", + logger.info("[%s]: Performing request %s from user %r (IPMI) as %r (KVMD)", session.sockaddr[0], name, credentials.ipmi_user, credentials.kvmd_user) try: async with self.__kvmd.make_session(credentials.kvmd_user, credentials.kvmd_passwd) as kvmd_session: method = functools.reduce(getattr, method_path.split("."), kvmd_session) return (await method(**kwargs)) except (aiohttp.ClientError, asyncio.TimeoutError) as err: - logger.error("Can't perform request %s: %s", name, err) + logger.error("[%s]: Can't perform request %s: %s", session.sockaddr[0], name, err) raise return aiotools.run_sync(runner()) -- cgit v1.2.3