Reputation: 420
Before I dig into the code too much and learn about Python's logging module (this looks to be what waf is using), I thought I'd see if someone might know a quick answer to this question. I want to display the output from a build on my console/terminal as well as have it logged to a file. I'm (unfortunately) in a windows environment and I'd rather not use mtee as it loses the nice colorized text. Is there a built in way with waf that I'm not aware of?
Upvotes: 2
Views: 1086
Reputation: 1494
You can try that to print to a log file as well as stdout:
import sys, logging
from waflib import Logs
bld.logger = Logs.make_logger('test.log', 'build')
hdlr = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('%(message)s')
hdlr.setFormatter(formatter)
bld.logger.addHandler(hdlr)
Upvotes: 1