diff options
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 73d8fe92a8..cb53f3e54f 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -29,15 +29,17 @@ from bb.cooker import state | |||
29 | import bb.fetch2 | 29 | import bb.fetch2 |
30 | 30 | ||
31 | class Tinfoil: | 31 | class Tinfoil: |
32 | def __init__(self): | 32 | def __init__(self, output=sys.stdout): |
33 | # Needed to avoid deprecation warnings with python 2.6 | 33 | # Needed to avoid deprecation warnings with python 2.6 |
34 | warnings.filterwarnings("ignore", category=DeprecationWarning) | 34 | warnings.filterwarnings("ignore", category=DeprecationWarning) |
35 | 35 | ||
36 | # Set up logging | 36 | # Set up logging |
37 | self.logger = logging.getLogger('BitBake') | 37 | self.logger = logging.getLogger('BitBake') |
38 | console = logging.StreamHandler(sys.stdout) | 38 | console = logging.StreamHandler(output) |
39 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | ||
40 | bb.msg.addDefaultlogFilter(console) | 39 | bb.msg.addDefaultlogFilter(console) |
40 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | ||
41 | if output.isatty(): | ||
42 | format.enable_color() | ||
41 | console.setFormatter(format) | 43 | console.setFormatter(format) |
42 | self.logger.addHandler(console) | 44 | self.logger.addHandler(console) |
43 | 45 | ||