summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/msg.py85
1 files changed, 4 insertions, 81 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 77a7a0fed2..ecf756ee25 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -94,35 +94,6 @@ class BBLogFilter(object):
94 return False 94 return False
95 95
96 96
97class Loggers(dict):
98 def __getitem__(self, key):
99 if key in self:
100 return dict.__getitem__(self, key)
101 else:
102 log = logging.getLogger("BitBake.%s" % domain._fields[key])
103 dict.__setitem__(self, key, log)
104 return log
105
106def _NamedTuple(name, fields):
107 Tuple = collections.namedtuple(name, " ".join(fields))
108 return Tuple(*range(len(fields)))
109
110domain = _NamedTuple("Domain", (
111 "Default",
112 "Build",
113 "Cache",
114 "Collection",
115 "Data",
116 "Depends",
117 "Fetcher",
118 "Parsing",
119 "PersistData",
120 "Provider",
121 "RunQueue",
122 "TaskData",
123 "Util"))
124logger = logging.getLogger("BitBake")
125loggers = Loggers()
126 97
127# Message control functions 98# Message control functions
128# 99#
@@ -156,11 +127,6 @@ def addDefaultlogFilter(handler):
156 for (domainarg, iterator) in groupby(domains): 127 for (domainarg, iterator) in groupby(domains):
157 dlevel = len(tuple(iterator)) 128 dlevel = len(tuple(iterator))
158 debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1 129 debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1
159 for index, msgdomain in enumerate(domain._fields):
160 if msgdomain == domainarg:
161 break
162 else:
163 warn(None, "Logging domain %s is not valid, ignoring" % domainarg)
164 130
165 BBLogFilter(handler, level, debug_domains) 131 BBLogFilter(handler, level, debug_domains)
166 132
@@ -168,53 +134,10 @@ def addDefaultlogFilter(handler):
168# Message handling functions 134# Message handling functions
169# 135#
170 136
171def debug(level, msgdomain, msg):
172 warnings.warn("bb.msg.debug is deprecated in favor of the python 'logging' module",
173 DeprecationWarning, stacklevel=2)
174 level = logging.DEBUG - (level - 1)
175 if not msgdomain:
176 logger.debug(level, msg)
177 else:
178 loggers[msgdomain].debug(level, msg)
179
180def plain(msg):
181 warnings.warn("bb.msg.plain is deprecated in favor of the python 'logging' module",
182 DeprecationWarning, stacklevel=2)
183 logger.plain(msg)
184
185def note(level, msgdomain, msg):
186 warnings.warn("bb.msg.note is deprecated in favor of the python 'logging' module",
187 DeprecationWarning, stacklevel=2)
188 if level > 1:
189 if msgdomain:
190 logger.verbose(msg)
191 else:
192 loggers[msgdomain].verbose(msg)
193 else:
194 if msgdomain:
195 logger.info(msg)
196 else:
197 loggers[msgdomain].info(msg)
198
199def warn(msgdomain, msg):
200 warnings.warn("bb.msg.warn is deprecated in favor of the python 'logging' module",
201 DeprecationWarning, stacklevel=2)
202 if not msgdomain:
203 logger.warn(msg)
204 else:
205 loggers[msgdomain].warn(msg)
206
207def error(msgdomain, msg):
208 warnings.warn("bb.msg.error is deprecated in favor of the python 'logging' module",
209 DeprecationWarning, stacklevel=2)
210 if not msgdomain:
211 logger.error(msg)
212 else:
213 loggers[msgdomain].error(msg)
214
215def fatal(msgdomain, msg): 137def fatal(msgdomain, msg):
216 if not msgdomain: 138 if msgdomain:
217 logger.critical(msg) 139 logger = logging.getLogger("BitBake.%s" % msgdomin)
218 else: 140 else:
219 loggers[msgdomain].critical(msg) 141 logger = logging.getLogger("BitBake")
142 logger.critical(msg)
220 sys.exit(1) 143 sys.exit(1)