private void configureLogging(StandardOptions options) {
        Level level = options.logging();

        // Be sure to restore the rootLevel logging when done with the CLI.
        Level previousRootLevel = rootLogger.getLevel();
        restoreFunctions.add(() -> rootLogger.setLevel(previousRootLevel));
        rootLogger.setLevel(level);

        // Set the log level on each handler attached to the root handler.
        for (Handler h : rootLogger.getHandlers()) {
            if (h.getLevel() != level) {
                // Change the log level if needed.
                Level currentLevel = h.getLevel();
                restoreFunctions.add(() -> h.setLevel(currentLevel));
                h.setLevel(level);
            }
        }

        if (level == Level.OFF) {
            // If logging was disabled with --logging OFF, then remove the smithy logger.
            rootLogger.removeHandler(smithyHandler);
        } else if (options.debug()) {
            smithyHandler.setFormatter(new DebugFormatter());
        }
    }
Wraps {@code Arguments} and configures logging based on arguments that aren't yet parsed.
smithy-cli/src/main/java/software/amazon/smithy/cli/LoggingArgumentsHandler.java