Class Log
java.lang.Object
br.net.dd.netherwingcore.common.logging.Log
Provides functionalities for logging messages to various log files with different severity levels.
The logging framework supports structured messages with details like logging level and file targets.
This class handles the construction, formatting, and writing of log messages.
-
Method Summary
Modifier and TypeMethodDescriptionvoidLogs a debug message with optional parameters for formatting.voidLogs an error message with optional parameters for formatting.voidLogs a fatal error message with optional parameters for formatting.static LogFactory method to obtain a logger instance for a specific class.voidLogs an informational message with optional parameters for formatting.booleanGetters and setters for the debugEnabled field, which indicates whether debug logging is enabled.voidLogs a message with additional details such as logging level and target files.voidLogs a simple informational message.voidsetDebugEnabled(boolean debugEnabled) Sets the debugEnabled field to enable or disable debug logging.voidLogs a trace message with optional parameters for formatting.voidLogs a warning message with optional parameters for formatting.
-
Method Details
-
getLogger
Factory method to obtain a logger instance for a specific class. This method creates and returns a new Log instance associated with the provided class name.- Parameters:
className- The name of the class for which the logger is being created. This is typically the simple name of the class (e.g., MyClass.class.getSimpleName()).- Returns:
- A new Log instance that can be used for logging messages related to the specified class.
-
log
Logs a simple informational message. By default, the message is logged with theLevel.INFORMATIONseverity.- Parameters:
message- A string message to log.
-
info
Logs an informational message with optional parameters for formatting. The message is formatted using the provided parameters if any are given.- Parameters:
message- The informational message to log, which should be an instance ofInformationMessage.parameters- Optional parameters to format the message. If provided, the message will be formatted using these parameters before logging.
-
warn
Logs a warning message with optional parameters for formatting. The message is formatted using the provided parameters if any are given.- Parameters:
message- The warning message to log, which should be an instance ofWarningMessage.parameters- Optional parameters to format the message. If provided, the message will be formatted using these parameters before logging.
-
error
Logs an error message with optional parameters for formatting. The message is formatted using the provided parameters if any are given.- Parameters:
message- The error message to log, which should be an instance ofErrorMessage.parameters- Optional parameters to format the message. If provided, the message will be formatted using these parameters before logging.
-
fatal
Logs a fatal error message with optional parameters for formatting. The message is formatted using the provided parameters if any are given.- Parameters:
message- The fatal error message to log, which should be an instance ofFatalErrorMessage.parameters- Optional parameters to format the message. If provided, the message will be formatted using these parameters before logging.
-
debug
Logs a debug message with optional parameters for formatting. The message is formatted using the provided parameters if any are given.- Parameters:
message- The debug message to log, which should be an instance ofDebugMessage.parameters- Optional parameters to format the message. If provided, the message will be formatted using these parameters before logging.
-
trace
Logs a trace message with optional parameters for formatting. The message is formatted using the provided parameters if any are given.- Parameters:
message- The trace message to log, which should be an instance ofTraceMessage.parameters- Optional parameters to format the message. If provided, the message will be formatted using these parameters before logging.
-
log
Logs a message with additional details such as logging level and target files. This method processes an array ofDetailobjects to determine the message, severity level, and the files where the logs will be written.For example: -
Messagecan specify the log message and itsLevel. -LogFileprovides paths to target log files. -
isDebugEnabled
public boolean isDebugEnabled()Getters and setters for the debugEnabled field, which indicates whether debug logging is enabled. This allows for dynamic control over the logging level, enabling or disabling debug messages as needed. -
setDebugEnabled
public void setDebugEnabled(boolean debugEnabled) Sets the debugEnabled field to enable or disable debug logging.- Parameters:
debugEnabled- A boolean value indicating whether debug logging should be enabled (true) or disabled (false).
-