From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH v1 1/2] framework/logger: getLogger will return existing logger
Date: Thu, 25 Jan 2018 02:10:28 -0500 [thread overview]
Message-ID: <1516864229-6034-1-git-send-email-yong.liu@intel.com> (raw)
Add list for saving all created loggers. Will return existing logger
when crb name and suite name are the same.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/logger.py b/framework/logger.py
index 78e90d6..8d0e5e8 100644
--- a/framework/logger.py
+++ b/framework/logger.py
@@ -92,6 +92,10 @@ RESET_COLOR = '\033[0m'
stream_fmt = '%(color)s%(name)30s: %(message)s' + RESET_COLOR
log_dir = None
+# List for saving all using loggers
+global Loggers
+Loggers = []
+
def set_verbose():
global verbose
@@ -356,7 +360,15 @@ def getLogger(name, crb="suite"):
"""
Get logger handler and if there's no handler for specified CRB will create one.
"""
+ global Loggers
+ # return saved logger
+ for logger in Loggers:
+ if logger['name'] == name and logger['crb'] == crb:
+ return logger['logger']
+
+ # return new logger
logger = DTSLOG(logging.getLogger(name), crb)
+ Loggers.append({'logger': logger, 'name': name, 'crb': crb})
return logger
--
1.9.3
next reply other threads:[~2018-01-25 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 7:10 Marvin Liu [this message]
2018-01-25 7:10 ` [dts] [PATCH v1 2/2] framework/packet: log scapy command for later debug Marvin Liu
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=1516864229-6034-1-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).