def configure(*args, **kwargs):
<EOL>assert len(HANDLERS) == <NUM_LIT:0><EOL>log_destinations = get_log_destinations()<EOL>if '<STR_LIT>' in log_destinations:<EOL><INDENT>HANDLERS.append(logging.StreamHandler())<EOL><DEDENT>def terrible_log_output(s):<EOL><INDENT>import sys<EOL>print(s, file=sys.stderr)<EOL><DEDENT>places = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>]<EOL>default_syslog_address = places[<NUM_LIT:0>]<EOL>for p in places:<EOL><INDENT>if path.exists(p):<EOL><INDENT>default_syslog_address = p<EOL>break<EOL><DEDENT><DEDENT>syslog_address = kwargs.setdefault('<STR_LIT>',<EOL>default_syslog_address)<EOL>valid_facility = False<EOL>if '<STR_LIT>' in log_destinations:<EOL><INDENT>facility, valid_facility = get_syslog_facility()<EOL>if not valid_facility:<EOL><INDENT>terrible_log_output('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>HANDLERS.append(handlers.SysLogHandler(syslog_address,<EOL>facility=facility))<EOL><DEDENT>except EnvironmentError as e:<EOL><INDENT>if e.errno in [errno.EACCES, errno.ECONNREFUSED]:<EOL><INDENT>message = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>').format(errno.errorcode[e.errno])<EOL>terrible_log_output(message)<EOL><DEDENT><DEDENT><DEDENT>fs = kwargs.get("<STR_LIT>", logging.BASIC_FORMAT)<EOL>dfs = kwargs.get("<STR_LIT>", None)<EOL>fmt = IndentFormatter(fs, dfs)<EOL>for handler in HANDLERS:<EOL><INDENT>handler.setFormatter(fmt)<EOL>logging.root.addHandler(handler)<EOL><DEDENT>set_level(kwargs.get('<STR_LIT>', logging.INFO))<EOL>
Configure logging.

Borrowed from logging.basicConfig

Uses the IndentFormatter instead of the regular Formatter

Also, opts the caller into Syslog output, unless syslog could not
be opened for some reason or another, in which case a warning will
be printed to the other log handlers.