diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-04-09 19:27:21 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:32 +0100 |
commit | 350c3126e130b1f6d22c6b5061a3feacc05025fc (patch) | |
tree | 690cf3ef9f1bf2271d0ddb7ee5d12fc5050d0999 | |
parent | 943ece8610fce9e6e5fda1b524ee479f013e8c5b (diff) | |
download | poky-350c3126e130b1f6d22c6b5061a3feacc05025fc.tar.gz |
Make the default domain a proper domain, not a string
This lets you do -l Default on the commandline to bump the debug level of
messages with no domain, without bumping the level of everything else.
(Bitbake rev: bef33dfc36713d8c93e38e63ddac2e4f9858e787)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r-- | bitbake/lib/bb/msg.py | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index cf79314017..5fc1d5d4ad 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py | |||
@@ -34,18 +34,19 @@ def _NamedTuple(name, fields): | |||
34 | return Tuple(*range(len(fields))) | 34 | return Tuple(*range(len(fields))) |
35 | 35 | ||
36 | domain = _NamedTuple("Domain",( | 36 | domain = _NamedTuple("Domain",( |
37 | 'Build', | 37 | "Default", |
38 | 'Cache', | 38 | "Build", |
39 | 'Collection', | 39 | "Cache", |
40 | 'Data', | 40 | "Collection", |
41 | 'Depends', | 41 | "Data", |
42 | 'Fetcher', | 42 | "Depends", |
43 | 'Parsing', | 43 | "Fetcher", |
44 | 'PersistData', | 44 | "Parsing", |
45 | 'Provider', | 45 | "PersistData", |
46 | 'RunQueue', | 46 | "Provider", |
47 | 'TaskData', | 47 | "RunQueue", |
48 | 'Util')) | 48 | "TaskData", |
49 | "Util")) | ||
49 | 50 | ||
50 | 51 | ||
51 | class MsgBase(bb.event.Event): | 52 | class MsgBase(bb.event.Event): |
@@ -80,13 +81,13 @@ class MsgPlain(MsgBase): | |||
80 | def set_debug_level(level): | 81 | def set_debug_level(level): |
81 | for d in domain: | 82 | for d in domain: |
82 | debug_level[d] = level | 83 | debug_level[d] = level |
83 | debug_level['default'] = level | 84 | debug_level[domain.Default] = level |
84 | 85 | ||
85 | def set_verbose(level): | 86 | def set_verbose(level): |
86 | verbose = level | 87 | verbose = level |
87 | 88 | ||
88 | def set_debug_domains(domain_strings): | 89 | def set_debug_domains(msgdomainstrings): |
89 | for domainstr in domain_strings: | 90 | for domainstr in msgdomainstrings: |
90 | for d in domain: | 91 | for d in domain: |
91 | if domain._fields[d] == domainstr: | 92 | if domain._fields[d] == domainstr: |
92 | debug_level[d] += 1 | 93 | debug_level[d] += 1 |
@@ -98,33 +99,35 @@ def set_debug_domains(domain_strings): | |||
98 | # Message handling functions | 99 | # Message handling functions |
99 | # | 100 | # |
100 | 101 | ||
101 | def debug(level, domain, msg, fn = None): | 102 | def debug(level, msgdomain, msg, fn = None): |
102 | if not domain: | 103 | if not msgdomain: |
103 | domain = 'default' | 104 | msgdomain = domain.Default |
104 | if debug_level[domain] >= level: | 105 | |
106 | if debug_level[msgdomain] >= level: | ||
105 | bb.event.fire(MsgDebug(msg), None) | 107 | bb.event.fire(MsgDebug(msg), None) |
106 | if not bb.event._ui_handlers: | 108 | if not bb.event._ui_handlers: |
107 | print 'DEBUG: ' + msg | 109 | print 'DEBUG: ' + msg |
108 | 110 | ||
109 | def note(level, domain, msg, fn = None): | 111 | def note(level, msgdomain, msg, fn = None): |
110 | if not domain: | 112 | if not msgdomain: |
111 | domain = 'default' | 113 | msgdomain = domain.Default |
112 | if level == 1 or verbose or debug_level[domain] >= 1: | 114 | |
115 | if level == 1 or verbose or debug_level[msgdomain] >= 1: | ||
113 | bb.event.fire(MsgNote(msg), None) | 116 | bb.event.fire(MsgNote(msg), None) |
114 | if not bb.event._ui_handlers: | 117 | if not bb.event._ui_handlers: |
115 | print 'NOTE: ' + msg | 118 | print 'NOTE: ' + msg |
116 | 119 | ||
117 | def warn(domain, msg, fn = None): | 120 | def warn(msgdomain, msg, fn = None): |
118 | bb.event.fire(MsgWarn(msg), None) | 121 | bb.event.fire(MsgWarn(msg), None) |
119 | if not bb.event._ui_handlers: | 122 | if not bb.event._ui_handlers: |
120 | print 'WARNING: ' + msg | 123 | print 'WARNING: ' + msg |
121 | 124 | ||
122 | def error(domain, msg, fn = None): | 125 | def error(msgdomain, msg, fn = None): |
123 | bb.event.fire(MsgError(msg), None) | 126 | bb.event.fire(MsgError(msg), None) |
124 | if not bb.event._ui_handlers: | 127 | if not bb.event._ui_handlers: |
125 | print 'ERROR: ' + msg | 128 | print 'ERROR: ' + msg |
126 | 129 | ||
127 | def fatal(domain, msg, fn = None): | 130 | def fatal(msgdomain, msg, fn = None): |
128 | bb.event.fire(MsgFatal(msg), None) | 131 | bb.event.fire(MsgFatal(msg), None) |
129 | if not bb.event._ui_handlers: | 132 | if not bb.event._ui_handlers: |
130 | print 'FATAL: ' + msg | 133 | print 'FATAL: ' + msg |