net.simplace.simulation.io.logging.Logger
Singleton logger to be used to organize the logging process.
Logger stores information about the log-level of the application
It can be used to trigger different log categories
use like:
if (Logger.isERROR()) Logger.ERROR("message", aException, this);
Additional features:
- for performance reasons you can always log to the root logger.
Use Method "setUseLOGGERclazz" to false if you want to do so.
- you can avoid the logger to print stack traces if you set the
Logger instance to true in "setDisableStackTrace".
public class Logger {
// Public Constructors
public Logger();
// Class Methods public static void
setLogLevel(
Logger.LOGLEVEL aLogLevel);
set the log level for the system manually
public static void
setLogLevel(int aLogLevel);
Use a numeric index to set a log level. Used for external calls from e.g. R.
Use LOGLEVEL.values() to see what log levels the indices correspond to.
public static void
setUseLOGGERclazz(boolean aUseLOGGERclazz);
for performance reasons you can always log to the root logger (false)
default is (true)
public static void
setDisableStackTrace(boolean aDisableStackTrace);
avoid the logger to print stack traces (true) default (false)
- aDisableStackTrace the disableStackTrace to set
public static boolean isTRACE();
if Debug should be logged returns true
returns the Trace
public static boolean isDEBUG();
if Debug should be logged returns true
returns the dEBUG
public static boolean isINFO();
if Info should be logged returns true
returns the iNFO
public static boolean isWARN();
if Warn should be logged returns true
returns the wARN
public static boolean isERROR();
if Error should be logged returns true
returns the eRROR
public static void
DEBUG(String aStringToLog, Throwable aExceptionToLog,
Object aThisInstance);
debug log with exception stack
- aStringToLog
- aExceptionToLog
- aThisInstance
public static void
DEBUG(String aStringToLog, Object aThisInstance);
debug log without exception stack
- aStringToLog
- aThisInstance
public static void
INFO(String aStringToLog, Throwable aExceptionToLog,
Object aThisInstance);
info log with exception stack
- aStringToLog
- aExceptionToLog
- aThisInstance
public static void
INFO(String aStringToLog, Object aThisInstance);
info log without exception stack
- aStringToLog
- aThisInstance
public static void
WARN(String aStringToLog, Throwable aExceptionToLog,
Object aThisInstance);
warn log with exception stack
- aStringToLog
- aExceptionToLog
- aThisInstance
public static void
WARN(String aStringToLog, Object aThisInstance);
warn log without exception stack
- aStringToLog
- aThisInstance
public static void
ERROR(String aStringToLog, Throwable aException, Object
This);
error log with exception stack
- aStringToLog
- aException
- This
public static void
FATAL(String aStringToLog, Throwable aExceptionToLog,
Object aThisInstance);
fatal log with exception stack
- aStringToLog
- aExceptionToLog
- aThisInstance
// Inner Classes
public static final class Logger.LOGLEVEL extends java.lang.Enum
}