Package xyz.tehbrian.restrictionhelper
Class DebugLogger
- java.lang.Object
-
- xyz.tehbrian.restrictionhelper.DebugLogger
-
public class DebugLogger extends java.lang.ObjectA small class to make debug logging easier. Ifdebugis set to true, messages logged usinglog(String)will be logged vialogger, else the message will just be ignored.
-
-
Constructor Summary
Constructors Constructor Description DebugLogger(java.util.logging.Logger logger)Creates a DebugLogger usingloggeras the internal Logger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetPrefix()Get the prefix to be prepended to the debug message.booleanisDebug()Get whether attempted debug logs will be logged vialogger.voidlog(java.lang.String message)voidlog(java.lang.String message, java.lang.Object... formats)Convenience method which appliesString.format(String, Object...)onto a message before passing it tolog(String).voidsetDebug(boolean debug)Set whether attempted debug logs will be logged vialogger.voidsetPrefix(java.lang.String prefix)Set the prefix to be prepended to the debug message.
-
-
-
Method Detail
-
isDebug
public boolean isDebug()
Get whether attempted debug logs will be logged vialogger.- Returns:
- whether debug is enabled or not
-
setDebug
public void setDebug(boolean debug)
Set whether attempted debug logs will be logged vialogger.- Parameters:
debug- whether debug should be enabled or not
-
getPrefix
public java.lang.String getPrefix()
Get the prefix to be prepended to the debug message.- Returns:
- the prefix
-
setPrefix
public void setPrefix(java.lang.String prefix)
Set the prefix to be prepended to the debug message.- Parameters:
prefix- the prefix
-
log
public void log(java.lang.String message)
- Parameters:
message- the message to log
-
log
public void log(java.lang.String message, java.lang.Object... formats)Convenience method which appliesString.format(String, Object...)onto a message before passing it tolog(String).- Parameters:
message- the message to logformats- formats to apply to the message
-
-