On 2023-08-02 19:36, [email protected] wrote:
From: Joe Slater<[email protected]>

Use QB_LOG_FILE to log to a file, and QB_LOG_LEVEL
to set the base log level.  Example values -

QB_LOG_FILE="runq.log"
QB_LOG_LEVEL=DEBUG

Signed-off-by: Joe Slater<[email protected]>
---
  scripts/runqemu | 16 ++++++++++++----
  1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 5e6793d44e..bea164d041 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -36,12 +36,20 @@ runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`\n\n 
%s" % message)
def create_logger():
      logger = logging.getLogger('runqemu')
-    logger.setLevel(logging.INFO)
+    try:
+        logger.setLevel(os.getenv("QB_LOG_LEVEL"))
+    except:
+        logger.setLevel(logging.INFO)
- # create console handler and set level to debug
-    ch = logging.StreamHandler()
-    ch.setLevel(logging.DEBUG)

Better to keep the log level the same or call out the change in the short/long log.

../Randy

+ # create a handler and set level to debug
+    try:
+        ch = logging.FileHandler(os.getenv("QB_LOG_FILE"))
+    except:
+        ch = logging.StreamHandler()
+
+    ch.setLevel(logging.DEBUG)
+
      # create formatter
      formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')


--
# Randy MacLeod
# Wind River Linux
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185445): 
https://lists.openembedded.org/g/openembedded-core/message/185445
Mute This Topic: https://lists.openembedded.org/mt/100516758/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to