1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

build: send logging messages to the log file for python functions

(Bitbake rev: ee1cce6ab21ddda60a7a070d03e98ff8485a5e71)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Chris Larson
2010-12-09 23:38:35 -05:00
committed by Richard Purdie
parent 25e519a80f
commit aaa55880ac
3 changed files with 19 additions and 16 deletions
+2 -10
View File
@@ -26,6 +26,7 @@ import itertools
import xmlrpclib
import logging
import progressbar
import bb.msg
from bb import ui
from bb.ui import uihelper
@@ -57,15 +58,6 @@ class NonInteractiveProgress(object):
self.fobj.write("done.\n")
self.fobj.flush()
class BBLogFormatter(logging.Formatter):
"""Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is"""
def format(self, record):
if record.levelno == logging.INFO + 1:
return record.getMessage()
else:
return logging.Formatter.format(self, record)
def main(server, eventHandler):
# Get values of variables which control our output
@@ -85,7 +77,7 @@ def main(server, eventHandler):
logging.addLevelName(level, logging.getLevelName(logging.DEBUG))
console = logging.StreamHandler(sys.stdout)
format = BBLogFormatter("%(levelname)s: %(message)s")
format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
console.setFormatter(format)
logger.addHandler(console)