From: <joe.slater@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Cc: <joe.slater@windriver.com>, <randy.macleod@windriver.com>
Subject: [oe-core][PATCH 1/1] runqemu: add some logging control
Date: Wed, 2 Aug 2023 16:36:26 -0700 [thread overview]
Message-ID: <20230802233626.3642612-1-joe.slater@windriver.com> (raw)
From: Joe Slater <joe.slater@windriver.com>
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 <joe.slater@windriver.com>
---
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)
+ # 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')
--
2.25.1
next reply other threads:[~2023-08-02 23:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 23:36 joe.slater [this message]
2023-08-03 0:45 ` [oe-core][PATCH 1/1] runqemu: add some logging control Randy MacLeod
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230802233626.3642612-1-joe.slater@windriver.com \
--to=joe.slater@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=randy.macleod@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox