Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MENFORCER-488] Add EnforcerLogger.is<Level>Enabled() #279

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion enforcer-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>

<artifactId>enforcer-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public interface EnforcerLogger {
*/
void warnOrError(Supplier<CharSequence> messageSupplier);

/**
* Is the logger instance enabled for the DEBUG level?
*
* @return {@code true} if this Logger is enabled for the DEBUG level, {@code false} otherwise.
* @since 3.4.0
*/
boolean isDebugEnabled();

/**
* Log message in {@code debug} level.
*
Expand All @@ -60,6 +68,14 @@ public interface EnforcerLogger {
*/
void debug(Supplier<CharSequence> messageSupplier);

/**
* Is the logger instance enabled for the INFO level?
*
* @return {@code true} if this Logger is enabled for the INFO level, {@code false} otherwise.
* @since 3.4.0
*/
boolean isInfoEnabled();

/**
* Log message in {@code info} level.
*
Expand All @@ -76,6 +92,14 @@ public interface EnforcerLogger {
*/
void info(Supplier<CharSequence> messageSupplier);

/**
* Is the logger instance enabled for the WARN level?
*
* @return {@code true} if this Logger is enabled for the WARN level, {@code false} otherwise.
* @since 3.4.0
*/
boolean isWarnEnabled();

/**
* Log message in {@code warn} level.
*
Expand All @@ -92,6 +116,14 @@ public interface EnforcerLogger {
*/
void warn(Supplier<CharSequence> messageSupplier);

/**
* Is the logger instance enabled for the ERROR level?
*
* @return {@code true} if this Logger is enabled for the ERROR level, {@code false} otherwise.
* @since 3.4.0
*/
boolean isErrorEnabled();

/**
* Log message in {@code error} level.
*
Expand Down
2 changes: 1 addition & 1 deletion enforcer-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>

<artifactId>enforcer-rules</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-enforcer-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.extensions</groupId>
<artifactId>maven-enforcer-extension</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-enforcer-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ protected AbstractEnforcerLogger(Log log) {
this.log = Objects.requireNonNull(log, "log must be not null");
}

@Override
public boolean isDebugEnabled() {
return log.isDebugEnabled();
}

@Override
public void debug(CharSequence message) {
log.debug(message);
Expand All @@ -50,6 +55,11 @@ public void debug(Supplier<CharSequence> messageSupplier) {
}
}

@Override
public boolean isInfoEnabled() {
return log.isInfoEnabled();
}

@Override
public void info(CharSequence message) {
log.info(message);
Expand All @@ -62,6 +72,11 @@ public void info(Supplier<CharSequence> messageSupplier) {
}
}

@Override
public boolean isWarnEnabled() {
return log.isWarnEnabled();
}

@Override
public void warn(CharSequence message) {
log.warn(message);
Expand All @@ -74,6 +89,11 @@ public void warn(Supplier<CharSequence> messageSupplier) {
}
}

@Override
public boolean isErrorEnabled() {
return log.isErrorEnabled();
}

@Override
public void error(CharSequence message) {
log.error(message);
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</parent>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Apache Maven Enforcer</name>
Expand Down Expand Up @@ -81,7 +81,7 @@
<maven.site.path>enforcer-archives/enforcer-LATEST</maven.site.path>
<javaVersion>8</javaVersion>
<mockito.version>4.11.0</mockito.version>
<project.build.outputTimestamp>2023-04-01T21:03:41Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-07-04T18:27:24Z</project.build.outputTimestamp>
<!-- the same as Maven 3.2.5 -->
<aether.version>1.0.0.v20140518</aether.version>

Expand Down