xichen01 opened a new pull request, #5718:
URL: https://github.com/apache/ozone/pull/5718
## What changes were proposed in this pull request?
Implementation of lazy audit log message building by the `MessageSupplier`,
which performs audit log building only when the log will be output.
```java
public void logWriteSuccess(AuditMessage.Builder msg) {
if (shouldLogAtDebug(msg)) {
this.logger.logIfEnabled(
FQCN, Level.DEBUG, WRITE_MARKER, msg::build, null);
} else {
this.logger.logIfEnabled(
FQCN, Level.INFO, WRITE_MARKER, msg::build, null);
}
}
```
`logIfEnabled`:
```java
public interface ExtendedLogger extends L
ogger {
//...
/**
* Logs a message which is only to be constructed if the specified level
is active.
*
* @param fqcn The fully qualified class name of the logger entry point,
used to determine the caller class and
* method when location information needs to be logged.
* @param level The logging Level to check.
* @param marker A Marker or null.
* @param msgSupplier A function, which when called, produces the
desired log message.
* @param t the exception to log, including its stack trace.
*/
void logIfEnabled(String fqcn, Level level, Marker marker,
MessageSupplier msgSupplier, Throwable t);
}
```
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9822
## How was this patch tested?
existing test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]