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
Modifier and TypeClassDescriptionstatic enum
Represents the severity levels of log messages. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addSink
(OutputStream sink) Adds sink to which log messages will be written.static void
Logs a message with the DEBUG severity level.static void
Logs a message with the ERROR severity level.static void
Logs a message with the FATAL severity level and exits the program.static void
Logs a message with the INFO severity level.static void
setLevel
(Log.Severity level) Sets the severity level of the logger.static void
setLogToStdout
(boolean logToStdout) Sets whether log messages should be written to stdout.static void
Logs a message with the TRACE severity level.static void
Logs 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.
-