RED-8694 - Add more javadoc #492
@ -7,24 +7,61 @@ import com.iqser.red.service.redaction.v1.server.service.websocket.WebSocketServ
|
||||
|
||||
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
|
||||
public class RulesLogger {
|
||||
|
||||
private final WebSocketService webSocketService;
|
||||
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) {
|
||||
|
||||
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) {
|
||||
|
||||
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) {
|
||||
|
||||
log(LogLevel.ERROR, message + " Exception: " + throwable.toString(), args);
|
||||
|
||||
@ -24,6 +24,10 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
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
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user