RED-8694 - Add more javadoc #492
@ -7,24 +7,61 @@ import com.iqser.red.service.redaction.v1.server.service.websocket.WebSocketServ
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides logging functionality specifically for rules execution
|
||||||
|
* in a Drools context. It is designed to log messages with different log levels
|
||||||
|
* (INFO, WARN, ERROR) and formats messages using a placeholder-based approach
|
||||||
|
* similar to popular logging frameworks like SLF4J.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Log messages can include placeholders (i.e., `{}`), which will be replaced by
|
||||||
|
* the corresponding arguments when the message is formatted.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <pre>
|
||||||
|
* logger.info("Message with placeholder {}", object);
|
||||||
|
* </pre>
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RulesLogger {
|
public class RulesLogger {
|
||||||
|
|
||||||
private final WebSocketService webSocketService;
|
private final WebSocketService webSocketService;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs a message at the INFO level.
|
||||||
|
*
|
||||||
|
* @param message The log message containing optional placeholders (i.e., `{}`).
|
||||||
|
* @param args The arguments to replace the placeholders in the message.
|
||||||
|
*/
|
||||||
public void info(String message, Object... args) {
|
public void info(String message, Object... args) {
|
||||||
|
|
||||||
log(LogLevel.INFO, message, args);
|
log(LogLevel.INFO, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs a message at the WARN level.
|
||||||
|
*
|
||||||
|
* @param message The log message containing optional placeholders (i.e., `{}`).
|
||||||
|
* @param args The arguments to replace the placeholders in the message.
|
||||||
|
*/
|
||||||
public void warn(String message, Object... args) {
|
public void warn(String message, Object... args) {
|
||||||
|
|
||||||
log(LogLevel.WARN, message, args);
|
log(LogLevel.WARN, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs a message at the ERROR level, including an exception.
|
||||||
|
*
|
||||||
|
* @param throwable The exception to log.
|
||||||
|
* @param message The log message containing optional placeholders (i.e., `{}`).
|
||||||
|
* @param args The arguments to replace the placeholders in the message.
|
||||||
|
*/
|
||||||
public void error(Throwable throwable, String message, Object... args) {
|
public void error(Throwable throwable, String message, Object... args) {
|
||||||
|
|
||||||
log(LogLevel.ERROR, message + " Exception: " + throwable.toString(), args);
|
log(LogLevel.ERROR, message + " Exception: " + throwable.toString(), args);
|
||||||
|
|||||||
@ -24,6 +24,10 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a text entity within a document, characterized by its text range, type, entity type,
|
||||||
|
* and associated metadata like matched rules, pages, and engines.
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user