2

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?

kcstrom
  • 422
  • 3
  • 10

1 Answers1

1

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)
cJ Zougloub
  • 1,484
  • 10
  • 19
  • assigning to `bld.logger` has side effects (like enabling output of the argument to Context.exec_command ) – Jason S Jun 24 '16 at 20:59