def setup_stream_handlers(conf):
class StdoutFilter(logging.Filter):<EOL><INDENT>def filter(self, record):<EOL><INDENT>return record.levelno in (logging.DEBUG, logging.INFO)<EOL><DEDENT><DEDENT>log.handlers = []<EOL>stdout_handler = logging.StreamHandler(sys.stdout)<EOL>stdout_handler.setLevel(logging.WARNING)<EOL>stdout_handler.addFilter(StdoutFilter())<EOL>if conf.debug:<EOL><INDENT>stdout_handler.setLevel(logging.DEBUG)<EOL><DEDENT>elif conf.verbose:<EOL><INDENT>stdout_handler.setLevel(logging.INFO)<EOL><DEDENT>else:<EOL><INDENT>stdout_handler.setLevel(logging.WARNING)<EOL><DEDENT>log.addHandler(stdout_handler)<EOL>stderr_handler = logging.StreamHandler(sys.stderr)<EOL>msg_format = "<STR_LIT>"<EOL>stderr_handler.setFormatter(logging.Formatter(fmt=msg_format))<EOL>stderr_handler.setLevel(logging.WARNING)<EOL>log.addHandler(stderr_handler)<EOL>
Setup logging stream handlers according to the options.