def setup_logging(name: str, testing=False, verbose=False, log_stderr=True, log_file=False, log_file_json=False):
    root_logger = logging.getLogger()
    root_logger.setLevel((logging.DEBUG if verbose else logging.INFO))
    root_logger.handlers = []
    if log_stderr:
        root_logger.addHandler(_create_stderr_handler())
    if log_file:
        root_logger.addHandler(_create_file_handler(name, testing=testing, log_json=log_file_json))

    def excepthook(type_, value, traceback):
        root_logger.exception('Unhandled exception', exc_info=(type_, value, traceback))
        if (not log_stderr):
            sys.__excepthook__(type_, value, traceback)
    sys.excepthook = excepthook
def setup_logging(name: str, testing=False, verbose=False, log_stderr=True, log_file=False, log_file_json=False):
    root_logger = logging.getLogger()
    root_logger.setLevel((logging.DEBUG if verbose else logging.INFO))
    root_logger.handlers = []
    if log_stderr:
        root_logger.addHandler(_create_stderr_handler())
    if log_file:
        root_logger.addHandler(_create_file_handler(name, testing=testing, log_json=log_file_json))

    def excepthook(type_, value, traceback):
        root_logger.exception('Unhandled exception', exc_info=(type_, value, traceback))
        if (not log_stderr):
            sys.__excepthook__(type_, value, traceback)
    sys.excepthook = excepthook