static void logTerminatingException(
      ConsoleLogger consoleLogger, Exception exception, boolean logStackTrace) {
    if (logStackTrace) {
      StringWriter writer = new StringWriter();
      exception.printStackTrace(new PrintWriter(writer));
      consoleLogger.log(LogEvent.Level.ERROR, writer.toString());
    }

    consoleLogger.log(
        LogEvent.Level.ERROR,
        "\u001B[31;1m"
            + exception.getClass().getName()
            + ": "
            + exception.getMessage()
            + "\u001B[0m");
  }
@Test
  public void testLogTerminatingException() {
    JibCli.logTerminatingException(logger, new IOException("test error message"), false);

    verify(logger)
        .log(LogEvent.Level.ERROR, "\u001B[31;1mjava.io.IOException: test error message\u001B[0m");
    verifyNoMoreInteractions(logger);
  }