def _init_log_no_output(): # XXX: all this heavily plays with waf internals - only use for unit # testing bento where waf output screws up nose own output/logging magic from six.moves import cStringIO Logs.got_tty = False Logs.get_term_cols = lambda: 80 Logs.get_color = lambda cl: '' Logs.colors = Logs.color_dict() fake_output = cStringIO() def fake_pprint(col, str, label='', sep='\n'): fake_output.write( "%s%s%s %s%s" % (Logs.colors(col), str, Logs.colors.NORMAL, label, sep)) Logs.pprint = fake_pprint log = logging.getLogger('waflib') log.handlers = [] log.filters = [] hdlr = logging.StreamHandler(cStringIO()) hdlr.setFormatter(Logs.formatter()) log.addHandler(hdlr) log.addFilter(Logs.log_filter()) log.setLevel(logging.DEBUG) Logs.log = log
def attach(self): return # Attach handlers if not self.sys_log_handler: self.sys_log_handler = self.SysLogHandler(self.parent) waf_logs.set_external_log_handler("options_log", self.sys_log_handler) if not self.waf_log_handler: self.waf_log_handler = self.WafLogHandler(self.parent) self.waf_log_handler.setFormatter(waf_logs.formatter()) log = logging.getLogger('waflib') log.addHandler(self.waf_log_handler)
def _init_log_no_output(): # XXX: all this heavily plays with waf internals - only use for unit # testing bento where waf output screws up nose own output/logging magic from six.moves import cStringIO Logs.got_tty = False Logs.get_term_cols = lambda: 80 Logs.get_color = lambda cl: '' Logs.colors = Logs.color_dict() fake_output = cStringIO() def fake_pprint(col, str, label='', sep='\n'): fake_output.write("%s%s%s %s%s" % (Logs.colors(col), str, Logs.colors.NORMAL, label, sep)) Logs.pprint = fake_pprint log = logging.getLogger('waflib') log.handlers = [] log.filters = [] hdlr = logging.StreamHandler(cStringIO()) hdlr.setFormatter(Logs.formatter()) log.addHandler(hdlr) log.addFilter(Logs.log_filter()) log.setLevel(logging.DEBUG) Logs.log = log