diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2020-03-09 11:33:39 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-13 11:29:23 +0000 |
commit | 26473bfbeaed905e72ca95cf69d7bef3422814ac (patch) | |
tree | 2023c98e0fa9378988ce5552052014faea1658ef /bitbake/lib/bb/msg.py | |
parent | 954b5258f182c71f9df2862d2771b5bdc82099e2 (diff) | |
download | poky-26473bfbeaed905e72ca95cf69d7bef3422814ac.tar.gz |
bitbake: lib/bb/msg: Convert default domains to a dictionary
Converts the default domain variable to a dictionary where the keys are
the logging domains and the values are the logging level (instead of the
debug count). This makes it easier to deal with the logging domains and
the awkward conversion from a list to a dictionary only needs to be done
once when logging is initialized. Finally, other code has been written
that already assumes this variable is a dictionary, see:
f04cd93109 ("bitbake: lib/bb: Optimise out debug messages from cooker")
(Bitbake rev: f32a8bc7ff7a0b0750b6934a96f5d48391b1383a)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/msg.py')
-rw-r--r-- | bitbake/lib/bb/msg.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index 33c0e2fa19..d1b0e929d4 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py | |||
@@ -138,7 +138,7 @@ class BBLogFilterStdOut(BBLogFilter): | |||
138 | loggerDefaultDebugLevel = 0 | 138 | loggerDefaultDebugLevel = 0 |
139 | loggerDefaultVerbose = False | 139 | loggerDefaultVerbose = False |
140 | loggerVerboseLogs = False | 140 | loggerVerboseLogs = False |
141 | loggerDefaultDomains = [] | 141 | loggerDefaultDomains = {} |
142 | 142 | ||
143 | def init_msgconfig(verbose, debug, debug_domains=None): | 143 | def init_msgconfig(verbose, debug, debug_domains=None): |
144 | """ | 144 | """ |
@@ -148,15 +148,16 @@ def init_msgconfig(verbose, debug, debug_domains=None): | |||
148 | bb.msg.loggerDefaultVerbose = verbose | 148 | bb.msg.loggerDefaultVerbose = verbose |
149 | if verbose: | 149 | if verbose: |
150 | bb.msg.loggerVerboseLogs = True | 150 | bb.msg.loggerVerboseLogs = True |
151 | |||
152 | bb.msg.loggerDefaultDomains = {} | ||
151 | if debug_domains: | 153 | if debug_domains: |
152 | bb.msg.loggerDefaultDomains = debug_domains | 154 | for (domainarg, iterator) in groupby(debug_domains): |
153 | else: | 155 | dlevel = len(tuple(iterator)) |
154 | bb.msg.loggerDefaultDomains = [] | 156 | bb.msg.loggerDefaultDomains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1 |
155 | 157 | ||
156 | def constructLogOptions(): | 158 | def constructLogOptions(): |
157 | debug = loggerDefaultDebugLevel | 159 | debug = loggerDefaultDebugLevel |
158 | verbose = loggerDefaultVerbose | 160 | verbose = loggerDefaultVerbose |
159 | domains = loggerDefaultDomains | ||
160 | 161 | ||
161 | if debug: | 162 | if debug: |
162 | level = BBLogFormatter.DEBUG - debug + 1 | 163 | level = BBLogFormatter.DEBUG - debug + 1 |
@@ -165,11 +166,7 @@ def constructLogOptions(): | |||
165 | else: | 166 | else: |
166 | level = BBLogFormatter.NOTE | 167 | level = BBLogFormatter.NOTE |
167 | 168 | ||
168 | debug_domains = {} | 169 | return level, loggerDefaultDomains |
169 | for (domainarg, iterator) in groupby(domains): | ||
170 | dlevel = len(tuple(iterator)) | ||
171 | debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1 | ||
172 | return level, debug_domains | ||
173 | 170 | ||
174 | def addDefaultlogFilter(handler, cls = BBLogFilter, forcelevel=None): | 171 | def addDefaultlogFilter(handler, cls = BBLogFilter, forcelevel=None): |
175 | level, debug_domains = constructLogOptions() | 172 | level, debug_domains = constructLogOptions() |