Class LoggerImpl
java.lang.Object
de.craftsblock.craftsnet.logging.impl.LoggerImpl
- All Implemented Interfaces:
Logger
The LoggerImpl class provides a simple logging mechanism for displaying log messages in the console with different log levels.
It supports INFO, WARNING, ERROR, and DEBUG log levels. Log messages are displayed with colored output, and the logger can be
configured to include or exclude DEBUG messages based on the debug mode setting. Additionally, the class provides helper methods
to log error messages along with exception stack traces. The log messages include timestamps, log levels, thread names, and the
actual log text to help with debugging and tracking application behavior.
- Since:
- 3.0.5-SNAPSHOT
-
Constructor Summary
ConstructorsConstructorDescriptionLoggerImpl(boolean debug) Constructs a Logger with the specified debug mode. -
Method Summary
Modifier and TypeMethodDescriptioncloneWithName(String name) Creates a clone of thisLoggerwith a specified name.voidLogs a debug message.voidLogs an error message along with the associated throwable.voidLogs an error message.voidLogs an error message along with the associated throwable.voidLogs an informational message.voidLogs a warning message.
-
Constructor Details
-
LoggerImpl
public LoggerImpl(boolean debug) Constructs a Logger with the specified debug mode.- Parameters:
debug- If set to true, debug messages will be printed; otherwise, they will be ignored.
-
-
Method Details
-
info
Logs an informational message. -
warning
Logs a warning message. -
error
Logs an error message. -
error
Logs an error message along with the associated throwable. -
error
Logs an error message along with the associated throwable. -
debug
Logs a debug message. -
cloneWithName
Creates a clone of thisLoggerwith a specified name.- Specified by:
cloneWithNamein interfaceLogger- Parameters:
name- The name for the cloned logger.- Returns:
- A new
Loggerinstance cloned from this logger with the given name.
-