From 8f951eea991ee962c4a894cfdf54526ba6fb3034 Mon Sep 17 00:00:00 2001 From: "Rico, Jonathan" Date: Fri, 19 Aug 2022 10:47:07 +0200 Subject: [PATCH] only print logs on failure --- conftest.py | 5 +++-- pytest.ini | 9 ++++++++- targettest/targettest/devkit.py | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/conftest.py b/conftest.py index c1317f8..e79b5e6 100644 --- a/conftest.py +++ b/conftest.py @@ -133,8 +133,9 @@ def testdevices(flasheddevices): devices = {'dut': dut, 'tester': tester} LOGGER.info(f'Test devices: {devices}') - # Start RTT logging - yield devices + LOGGER.info(f'[{dut_dk.segger_id}] DUT logs:\n{dut_dk.log}') + LOGGER.info(f'[{tester_dk.segger_id}] Tester logs:\n{tester_dk.log}') + LOGGER.debug('closing RPC channels') diff --git a/pytest.ini b/pytest.ini index 4b5f0f6..51b2f6d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,7 +1,14 @@ [pytest] filterwarnings = ignore:.*JLink module.*:PendingDeprecationWarning + +# Logging +log_level = INFO +log_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s) +log_date_format=%Y-%m-%d %H:%M:%S + +# Live console logs log_cli = 1 -log_cli_level = INFO +log_cli_level = WARNING log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s) log_cli_date_format=%Y-%m-%d %H:%M:%S diff --git a/targettest/targettest/devkit.py b/targettest/targettest/devkit.py index 0b0948b..138f59c 100644 --- a/targettest/targettest/devkit.py +++ b/targettest/targettest/devkit.py @@ -144,7 +144,6 @@ def stop_logging(self): self.rtt.close() finally: LOGGER.debug(f'[{self.segger_id}] logging stopped') - LOGGER.info(f'[{self.segger_id}] device logs:\n{self.log}') def open(self, open_emu=True): LOGGER.debug(f'[{self.segger_id}] devkit open')