Package ru.ispras.castle.util
Class Logger
- java.lang.Object
-
- ru.ispras.castle.util.Logger
-
public final class Logger extends java.lang.Object
TheLogger
class provides methods for logging-related tasks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Logger.EventType
Log message types.static interface
Logger.Listener
The listener for logger.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BAR
The separation line.static int
LINE_WIDTH
The log line width.
-
Constructor Summary
Constructors Constructor Description Logger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
debug(java.lang.String format, java.lang.Object... args)
Prints formatted debug message with the specified arguments to the log.static void
debugBar()
If debug mode is on, prints separation line.static void
debugHeader(java.lang.String text)
When debug mode is on, surrounds the text with debug header.static void
debugHeader(java.lang.String format, java.lang.Object... args)
When debug mode is on, prints formatted arguments surrounded by debug header.static void
error(java.lang.String format, java.lang.Object... args)
Prints formatted message with the specified arguments to the log.static void
exception(java.lang.Throwable throwable)
Prints error message for the unexpected event.static java.lang.String
getSupportEmail()
Returns the support email string.static boolean
isDebug()
Checks whether debug mode is enabled, or not.static void
message(java.lang.String format, java.lang.Object... args)
Prints formatted message with the specified arguments to the log.static void
setDebug(boolean value)
Enables\disables debug mode.static void
setListener(Logger.Listener value)
Sets the associated listener.static void
setSupportEmail(java.lang.String email)
Sets the support email.static void
warning(java.lang.String format, java.lang.Object... args)
Prints formatted warning with the specified arguments to the log.
-
-
-
Field Detail
-
LINE_WIDTH
public static final int LINE_WIDTH
The log line width.- See Also:
- Constant Field Values
-
BAR
public static final java.lang.String BAR
The separation line.
-
-
Method Detail
-
setDebug
public static void setDebug(boolean value)
Enables\disables debug mode.- Parameters:
value
-true
for debug mode to be enabled,false
otherwise.
-
isDebug
public static boolean isDebug()
Checks whether debug mode is enabled, or not.- Returns:
true
if debug mode is enabled,false
otherwise.
-
setListener
public static void setListener(Logger.Listener value)
Sets the associated listener.- Parameters:
value
- The listener that should be associated to the logger.
-
setSupportEmail
public static void setSupportEmail(java.lang.String email)
Sets the support email.- Parameters:
email
- The support email string.
-
getSupportEmail
public static java.lang.String getSupportEmail()
Returns the support email string.- Returns:
- The support email string.
-
message
public static void message(java.lang.String format, java.lang.Object... args)
Prints formatted message with the specified arguments to the log.- Parameters:
format
- The message format.args
- The arguments to be printed.
-
warning
public static void warning(java.lang.String format, java.lang.Object... args)
Prints formatted warning with the specified arguments to the log.- Parameters:
format
- The message format.args
- The arguments to be printed.
-
error
public static void error(java.lang.String format, java.lang.Object... args)
Prints formatted message with the specified arguments to the log.- Parameters:
format
- The message format.args
- The arguments to be printed.
-
debug
public static void debug(java.lang.String format, java.lang.Object... args)
Prints formatted debug message with the specified arguments to the log.- Parameters:
format
- The message format.args
- The arguments to be printed.
-
debugBar
public static void debugBar()
If debug mode is on, prints separation line.If debug mode is off, does nothing.
-
debugHeader
public static void debugHeader(java.lang.String format, java.lang.Object... args)
When debug mode is on, prints formatted arguments surrounded by debug header.When debug mode is off, does nothing.
- Parameters:
format
- The format for arguments.args
- The arguments to be printed.
-
debugHeader
public static void debugHeader(java.lang.String text)
When debug mode is on, surrounds the text with debug header.When debug mode is off, does nothing.
- Parameters:
text
- The text to be printed.
-
exception
public static void exception(java.lang.Throwable throwable)
Prints error message for the unexpected event.- Parameters:
throwable
- The unexpected event.
-
-