diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java index bce7e2a630..f27849b1ca 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java @@ -27,9 +27,21 @@ import org.apache.maven.api.annotations.Nonnull; * @see MessageBuilderFactory */ public interface MessageBuilder { + + /** + * Append message content in trace style. + * By default, bold magenta + * + * @param message the message to append + * @return the current builder + */ + @Nonnull + MessageBuilder trace(Object message); + /** * Append message content in debug style. * By default, bold cyan + * * @param message the message to append * @return the current builder */ @@ -39,6 +51,7 @@ public interface MessageBuilder { /** * Append message content in info style. * By default, bold blue + * * @param message the message to append * @return the current builder */ @@ -48,6 +61,7 @@ public interface MessageBuilder { /** * Append message content in warning style. * By default, bold yellow + * * @param message the message to append * @return the current builder */ @@ -57,6 +71,7 @@ public interface MessageBuilder { /** * Append message content in error style. * By default, bold red + * * @param message the message to append * @return the current builder */ @@ -66,6 +81,7 @@ public interface MessageBuilder { /** * Append message content in success style. * By default, bold green + * * @param message the message to append * @return the current builder */ @@ -75,6 +91,7 @@ public interface MessageBuilder { /** * Append message content in failure style. * By default, bold red + * * @param message the message to append * @return the current builder */ @@ -84,6 +101,7 @@ public interface MessageBuilder { /** * Append message content in strong style. * By default, bold + * * @param message the message to append * @return the current builder */ @@ -93,6 +111,7 @@ public interface MessageBuilder { /** * Append message content in mojo style. * By default, green + * * @param message the message to append * @return the current builder */ @@ -102,6 +121,7 @@ public interface MessageBuilder { /** * Append message content in project style. * By default, cyan + * * @param message the message to append * @return the current builder */ @@ -113,6 +133,7 @@ public interface MessageBuilder { // /** * Append content to the message buffer. + * * @param value the content to append * @param offset the index of the first {@code char} to append * @param len the number of {@code char}s to append @@ -123,6 +144,7 @@ public interface MessageBuilder { /** * Append content to the message buffer. + * * @param value the content to append * @return the current builder */ @@ -131,6 +153,7 @@ public interface MessageBuilder { /** * Append content to the message buffer. + * * @param value the content to append * @param start the starting index of the subsequence to be appended * @param end the end index of the subsequence to be appended @@ -141,6 +164,7 @@ public interface MessageBuilder { /** * Append content to the message buffer. + * * @param value the content to append * @return the current builder */ @@ -149,6 +173,7 @@ public interface MessageBuilder { /** * Append content to the message buffer. + * * @param value the content to append * @return the current builder */ @@ -157,6 +182,7 @@ public interface MessageBuilder { /** * Append newline to the message buffer. + * * @return the current builder */ @Nonnull @@ -165,6 +191,7 @@ public interface MessageBuilder { /** * Append formatted content to the buffer. * @see String#format(String, Object...) + * * @param pattern a format string * @param args arguments referenced by the format specifiers in the format string * @return the current builder @@ -174,6 +201,7 @@ public interface MessageBuilder { /** * Return the built message. + * * @return the message */ @Nonnull diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMessageBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMessageBuilder.java index 9c593e37bd..2761d57be6 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMessageBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMessageBuilder.java @@ -35,6 +35,12 @@ public class DefaultMessageBuilder implements MessageBuilder { this.buffer = buffer; } + @Override + @Nonnull + public MessageBuilder trace(Object o) { + return a(o); + } + @Override @Nonnull public MessageBuilder debug(Object o) { diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 847bfcec06..3d2e1d490a 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -594,6 +594,7 @@ public class MavenCli { if (MessageUtils.isColorEnabled()) { MessageBuilder buff = MessageUtils.builder(); buff.a("Message styles: "); + buff.trace("trace").a(' '); buff.debug("debug").a(' '); buff.info("info").a(' '); buff.warning("warning").a(' '); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/jansi/JansiMessageBuilder.java b/maven-embedder/src/main/java/org/apache/maven/cli/jansi/JansiMessageBuilder.java index 08a28ae911..419fd323aa 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/jansi/JansiMessageBuilder.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/jansi/JansiMessageBuilder.java @@ -35,6 +35,12 @@ public class JansiMessageBuilder implements MessageBuilder { this.ansi = Ansi.ansi(sb); } + @Override + @Nonnull + public MessageBuilder trace(Object o) { + return style(Style.TRACE, o); + } + @Override @Nonnull public MessageBuilder debug(Object o) { diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/jansi/Style.java b/maven-embedder/src/main/java/org/apache/maven/cli/jansi/Style.java index 936de82685..16ae2ad428 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/jansi/Style.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/jansi/Style.java @@ -28,6 +28,7 @@ import org.fusesource.jansi.Ansi.Color; * @since 4.0.0 */ enum Style { + TRACE("bold,magenta"), DEBUG("bold,cyan"), INFO("bold,blue"), WARNING("bold,yellow"), diff --git a/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java b/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java index c321b73427..fbb3e66cd7 100644 --- a/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java +++ b/maven-slf4j-provider/src/main/java/org/slf4j/impl/MavenSimpleLogger.java @@ -38,7 +38,7 @@ public class MavenSimpleLogger extends SimpleLogger { protected String renderLevel(int level) { switch (level) { case LOG_LEVEL_TRACE: - return builder().debug("TRACE").build(); + return builder().trace("TRACE").build(); case LOG_LEVEL_DEBUG: return builder().debug("DEBUG").build(); case LOG_LEVEL_INFO: