

def configure_logging(log_level=None, log_file=None, simplified_console_logs=False):
    '\n    This should be called once as early as possible in app startup to configure logging handlers and formatting.\n\n    :param log_level: The level at which to record log messages (DEBUG|INFO|NOTICE|WARNING|ERROR|CRITICAL)\n    :type log_level: str\n    :param log_file: The file to write logs to, or None to disable logging to a file\n    :type log_file: str | None\n    :param simplified_console_logs: Whether or not to use the simplified logging format and coloring\n    :type simplified_console_logs: bool\n    '
    logbook.set_datetime_format('local')
    logging.root.setLevel(logging.WARNING)
    logbook.compat.redirect_logging(set_root_logger_level=False)
    NullHandler().push_application()
    log_level = (log_level or Configuration['log_level'])
    (format_string, log_colors) = (_LOG_FORMAT_STRING, _LOG_COLORS)
    if simplified_console_logs:
        (format_string, log_colors) = (_SIMPLIFIED_LOG_FORMAT_STRING, _SIMPLIFIED_LOG_COLORS)
    log_handler = _ColorizingStreamHandler(stream=sys.stdout, level=log_level, format_string=format_string, log_colors=log_colors, bubble=True)
    log_handler.push_application()
    if log_file:
        fs.create_dir(os.path.dirname(log_file))
        previous_log_file_exists = os.path.exists(log_file)
        event_handler = _ColorizingRotatingFileHandler(filename=log_file, level=log_level, format_string=_LOG_FORMAT_STRING, log_colors=_LOG_COLORS, bubble=True, max_size=Configuration['max_log_file_size'], backup_count=Configuration['max_log_file_backups'])
        event_handler.push_application()
        if previous_log_file_exists:
            event_handler.perform_rollover(increment_logfile_counter=False)
        else:
            event_handler.log_application_summary()

dataset/ETHPy150Open box/ClusterRunner/app/util/log.py configure_logging/original