]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional: include logger name and function in messages
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 28 Oct 2025 18:26:50 +0000 (18:26 +0000)
committerThomas Huth <thuth@redhat.com>
Mon, 3 Nov 2025 07:27:59 +0000 (08:27 +0100)
As we collect debug logs from a wide range of code it becomes
increasingly confusing to understand where each log messages comes
from. Adding "%(name)s" gives us the logger name, which is usually
based on the python __name__ symbol, aka the code module name.
Then "%(funcName)s" completes the story by identifying the function.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20251028182651.873256-2-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/qemu_test/testcase.py

index a122acb56093806da9daabf8ec57a2acaf9c59ee..d9d114e63e3b81cfd39c604871fc8e5322138937 100644 (file)
@@ -217,7 +217,7 @@ class QemuBaseTest(unittest.TestCase):
         self._log_fh = logging.FileHandler(self.log_filename, mode='w')
         self._log_fh.setLevel(logging.DEBUG)
         fileFormatter = logging.Formatter(
-            '%(asctime)s - %(levelname)s: %(message)s')
+            '%(asctime)s - %(levelname)s: %(name)s.%(funcName)s %(message)s')
         self._log_fh.setFormatter(fileFormatter)
         self.log.addHandler(self._log_fh)