def init_logging(events_log_fname, verbose, quiet):
logger = logging.getLogger('<STR_LIT>')<EOL>logger.setLevel(logging.DEBUG)<EOL>console_handler = logging.StreamHandler(sys.stdout)<EOL>stderr_hdl = logging.StreamHandler(sys.stderr)<EOL>fmt_verbose = logging.Formatter(<EOL>"<STR_LIT>"<EOL>)<EOL>fmt_regular = logging.Formatter(<EOL>"<STR_LIT>", "<STR_LIT>")<EOL>if verbose:<EOL><INDENT>console_handler.setLevel(logging.DEBUG)<EOL>console_handler.setFormatter(fmt_verbose)<EOL>stderr_hdl.setFormatter(fmt_verbose)<EOL><DEDENT>elif quiet:<EOL><INDENT>console_handler.setLevel(logging.WARNING)<EOL>console_handler.setFormatter(fmt_regular)<EOL>stderr_hdl.setFormatter(fmt_regular)<EOL><DEDENT>else:<EOL><INDENT>console_handler.setLevel(logging.INFO)<EOL>console_handler.setFormatter(fmt_regular)<EOL>stderr_hdl.setFormatter(fmt_regular)<EOL><DEDENT>f_err = SingleLevelFilter(logging.ERROR, True)<EOL>f_warn = SingleLevelFilter(logging.WARNING, True)<EOL>f_crit = SingleLevelFilter(logging.CRITICAL, True)<EOL>console_handler.addFilter(f_err)<EOL>console_handler.addFilter(f_warn)<EOL>console_handler.addFilter(f_crit)<EOL>logger.addHandler(console_handler)<EOL>f_info = SingleLevelFilter(logging.INFO, True)<EOL>f_debug = SingleLevelFilter(logging.DEBUG, True)<EOL>stderr_hdl.addFilter(f_info)<EOL>stderr_hdl.addFilter(f_debug)<EOL>logger.addHandler(stderr_hdl)<EOL>if events_log_fname:<EOL><INDENT>err_file_handler = logging.FileHandler(events_log_fname)<EOL>err_file_handler.setLevel(logging.WARNING)<EOL>err_file_handler.setFormatter(<EOL>logging.Formatter(<EOL>"<STR_LIT>"<EOL>))<EOL>return [err_file_handler, console_handler, stderr_hdl]<EOL><DEDENT>else:<EOL><INDENT>return [console_handler, stderr_hdl]<EOL><DEDENT>
Set up logging, as it is very important for console tool