af17fc22fd
jiraProject== RHEL-798 Signed-off-by: John Kacur <jkacur@redhat.com>
43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From 78bd089e89e15b09db8e1d2bdcc0d9620d4da03c Mon Sep 17 00:00:00 2001
|
|
From: John Kacur <jkacur@redhat.com>
|
|
Date: Tue, 6 Dec 2022 14:44:44 -0500
|
|
Subject: rteval: Log.py: Convert to f-strings
|
|
|
|
Convert Log.py to f-strings
|
|
|
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
---
|
|
rteval/Log.py | 9 +++------
|
|
1 file changed, 3 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/rteval/Log.py b/rteval/Log.py
|
|
index 63ca3b8681f8..8d08ab3e210a 100644
|
|
--- a/rteval/Log.py
|
|
+++ b/rteval/Log.py
|
|
@@ -60,10 +60,7 @@ class Log:
|
|
|
|
def log(self, logtype, msg):
|
|
if (logtype & self.__logverb) or logtype == self.ALWAYS:
|
|
- self.__logfile.write("%s%s\n" %
|
|
- (self.__logtype_str(logtype),
|
|
- msg)
|
|
- )
|
|
+ self.__logfile.write(f"{self.__logtype_str(logtype)}{msg}\n")
|
|
|
|
|
|
|
|
@@ -80,8 +77,8 @@ def unit_test(rootdir):
|
|
def run_log_test(l):
|
|
for lt in range(min(logtypes), max(logtypes)*2):
|
|
test = ", ".join([logtypes_s[logtypes.index(i)] for i in [p for p in takewhile(lambda x: x <= lt, (2**i for i in count())) if p & lt]])
|
|
- print("Testing verbosity flags set to: (%i) %s" % (lt, test))
|
|
- msg = "Log entry when verbosity is set to %i [%s]" % (lt, test)
|
|
+ print(f"Testing verbosity flags set to: ({lt}) {test}")
|
|
+ msg = f"Log entry when verbosity is set to {lt} [{test}]"
|
|
l.SetLogVerbosity(lt)
|
|
test_log(l, msg)
|
|
print("-"*20)
|
|
--
|
|
2.40.1
|
|
|