public static ConsoleLogger newLogger(
      Verbosity verbosity,
      HttpTraceLevel httpTraceLevel,
      ConsoleOutput consoleOutput,
      PrintWriter stdout,
      PrintWriter stderr,
      SingleThreadedExecutor executor) {
    boolean enableRichProgress =
        isRichConsole(consoleOutput, httpTraceLevel) && verbosity.atLeast(Verbosity.lifecycle);
    ConsoleLoggerBuilder builder =
        enableRichProgress
            ? ConsoleLoggerBuilder.rich(executor, false)
            : ConsoleLoggerBuilder.plain(executor);
    if (verbosity.atLeast(Verbosity.error)) {
      builder.error(message -> stderr.println("[ERROR] " + message));
    }
    if (verbosity.atLeast(Verbosity.warn)) {
      builder.warn(message -> stdout.println("[WARN] " + message));
    }
    if (verbosity.atLeast(Verbosity.lifecycle)) {
      builder.lifecycle(stdout::println);
      // Rich progress reporting will be through ProgressEvent (note this is not LogEvent of
      // Level.PROGRESS), so we ignore PROGRESS LogEvent.
      if (!enableRichProgress) {
        builder.progress(stdout::println);
      }
    }
    if (verbosity.atLeast(Verbosity.info)) {
      builder.info(stdout::println);
    }
    if (verbosity.atLeast(Verbosity.debug)) {
      builder.debug(stdout::println);
    }

    return builder.build();
  }
Create a new logger for the CLI.

@param verbosity the configure verbosity
@param httpTraceLevel the log level for http trace
@param consoleOutput the configured consoleOutput format
@param stdout the writer to store stdout
@param stderr the writer to store stderr
@param executor a {@link SingleThreadedExecutor} to ensure that all messages are logged in a
    sequential, deterministic order
@return a new ConsoleLogger instance
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/logging/CliLogger.java