Skip to content

Commit

Permalink
Merge pull request dita-ot#4409 from dita-ot/feature/fix-colourless-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
jelovirt authored Feb 16, 2024
2 parents fa186a2 + 1e2878f commit d4722d6
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/main/java/org/dita/dost/log/AbstractLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,24 @@ protected void log(final String msg, final Object[] args, final Throwable t, fin
}
StringBuilder buf = null;
if (!legacyFormat) {
if (useColor && level == Project.MSG_ERR) {
buf =
new StringBuilder()
.append(ANSI_RED)
.append(Main.locale.getString("error_msg").formatted(""))
.append(ANSI_RESET);
} else if (useColor && level == Project.MSG_WARN) {
buf =
new StringBuilder()
.append(ANSI_YELLOW)
.append(Main.locale.getString("warn_msg").formatted(""))
.append(ANSI_RESET);
if (level == Project.MSG_ERR) {
buf = new StringBuilder();
if (useColor) {
buf.append(ANSI_RED);
}
buf.append(Main.locale.getString("error_msg").formatted(""));
if (useColor) {
buf.append(ANSI_RESET);
}
} else if (level == Project.MSG_WARN) {
buf = new StringBuilder();
if (useColor) {
buf.append(ANSI_YELLOW);
}
buf.append(Main.locale.getString("warn_msg").formatted(""));
if (useColor) {
buf.append(ANSI_RESET);
}
}
}
if (args.length > 0) {
Expand Down

0 comments on commit d4722d6

Please sign in to comment.