diff mbox series

[1/5] examples/client: use lazy logging

Message ID 20230116195059.25744-2-daniel@braunwarth.dev
State Accepted
Delegated to: Stefano Babic
Headers show
Series examples/client: Various improvements | expand

Commit Message

Daniel Braunwarth Jan. 16, 2023, 7:50 p.m. UTC
Fixes https://pylint.pycqa.org/en/latest/user_guide/messages/warning/logging-not-lazy.html

Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
---
 examples/client/swupdate_client.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Babic Jan. 22, 2023, 5:53 p.m. UTC | #1
> Fixes https://pylint.pycqa.org/en/latest/user_guide/messages/warning/logging-not-lazy.html
> Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
Applied to swupdate, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/examples/client/swupdate_client.py b/examples/client/swupdate_client.py
index a65121e..14711a6 100755
--- a/examples/client/swupdate_client.py
+++ b/examples/client/swupdate_client.py
@@ -52,7 +52,7 @@  class SWUpdater:
                         data = json.loads(message)
                     except json.decoder.JSONDecodeError:
                         # As of 2021.04, the version info message contains invalid json
-                        self._logger.warning(f"json parse error: {message}")
+                        self._logger.warning("json parse error: %s", message)
                         continue
 
                     if data["type"] != "message":
@@ -86,8 +86,8 @@  class SWUpdater:
 
             if response.status_code != 200:
                 self._logger.error(
-                    "Cannot upload software image: {}".format(response.status_code)
-                )
+                    "Cannot upload software image: %s",
+                    response.status_code)
                 return False
 
             self._logger.info(
@@ -100,7 +100,7 @@  class SWUpdater:
         except FileNotFoundError:
             self._logger.info("swu file not found")
         except requests.exceptions.ConnectionError as e:
-            self._logger.info("Connection Error:\n%s" % str(e))
+            self._logger.info("Connection Error:\n%s", e)
         return False
 
     async def start_tasks(self, timeout):