Package mastermind.utils
Class Log
java.lang.Object
mastermind.utils.Log
Represents a singleton logger for recording messages with different severity
levels.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the severity levels of log messages. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSink(OutputStream sink) Adds sink to which log messages will be written.static voidLogs a message with the DEBUG severity level.static voidLogs a message with the ERROR severity level.static voidLogs a message with the FATAL severity level and exits the program.static voidLogs a message with the INFO severity level.static voidsetLevel(Log.Severity level) Sets the severity level of the logger.static voidsetLogToStdout(boolean logToStdout) Sets whether log messages should be written to stdout.static voidLogs a message with the TRACE severity level.static voidLogs a message with the WARNING severity level.
-
Method Details
-
addSink
Adds sink to which log messages will be written.- Parameters:
sink- The output stream to add.
-
setLevel
Sets the severity level of the logger.Only messages with a severity level greater than or equal to this level will be logged.
- Parameters:
level- The severity level to set.
-
setLogToStdout
public static void setLogToStdout(boolean logToStdout) Sets whether log messages should be written to stdout.- Parameters:
logToStdout- The flag to set.
-
trace
Logs a message with the TRACE severity level.- Parameters:
msg- The message to log.
-
debug
Logs a message with the DEBUG severity level.- Parameters:
msg- The message to log.
-
info
Logs a message with the INFO severity level.- Parameters:
msg- The message to log.
-
warning
Logs a message with the WARNING severity level.- Parameters:
msg- The message to log.
-
error
Logs a message with the ERROR severity level.- Parameters:
msg- The message to log.
-
fatal
Logs a message with the FATAL severity level and exits the program.- Parameters:
msg- The message to log.
-