Class Logger

java.lang.Object
net.simplace.core.logging.Logger

public class Logger extends Object
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".
Author:
Andreas Enders
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    DEBUG(String aStringToLog, Object aThisInstance)
    debug log without exception stack
    static void
    DEBUG(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
    debug log with exception stack
    static void
    ERROR(String aStringToLog, Throwable aException, Object This)
    error log with exception stack
    static void
    FATAL(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
    fatal log with exception stack
    static void
    INFO(String aStringToLog, Object aThisInstance)
    info log without exception stack
    static void
    INFO(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
    info log with exception stack
    static boolean
    if Debug should be logged returns true
    static boolean
    if Error should be logged returns true
    static boolean
    if Info should be logged returns true
    static boolean
    if Debug should be logged returns true
    static boolean
    if Warn should be logged returns true
    static void
    setDisableStackTrace(boolean aDisableStackTrace)
    avoid the logger to print stack traces (true) default (false)
    static void
    setLogLevel(int aLogLevel)
    Use a numeric index to set a log level.
    static void
    set the log level for the system manually
    static void
    setUseLOGGERclazz(boolean aUseLOGGERclazz)
    for performance reasons you can always log to the root logger (false) default is (true)
    static void
    WARN(String aStringToLog, Object aThisInstance)
    warn log without exception stack
    static void
    WARN(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
    warn log with exception stack

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Logger

      public Logger()
  • Method Details

    • setLogLevel

      public static void setLogLevel(Logger.LOGLEVEL aLogLevel)
      set the log level for the system manually
      Parameters:
      aLogLevel -
    • setLogLevel

      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.

      Parameters:
      aLogLevel -
    • setUseLOGGERclazz

      public static void setUseLOGGERclazz(boolean aUseLOGGERclazz)
      for performance reasons you can always log to the root logger (false) default is (true)
      Parameters:
      aUseLOGGERclazz -
    • setDisableStackTrace

      public static void setDisableStackTrace(boolean aDisableStackTrace)
      avoid the logger to print stack traces (true) default (false)
      Parameters:
      aDisableStackTrace - the disableStackTrace to set
    • isTRACE

      public static boolean isTRACE()
      if Debug should be logged returns true
      Returns:
      the Trace
    • isDEBUG

      public static boolean isDEBUG()
      if Debug should be logged returns true
      Returns:
      the dEBUG
    • isINFO

      public static boolean isINFO()
      if Info should be logged returns true
      Returns:
      the iNFO
    • isWARN

      public static boolean isWARN()
      if Warn should be logged returns true
      Returns:
      the wARN
    • isERROR

      public static boolean isERROR()
      if Error should be logged returns true
      Returns:
      the eRROR
    • DEBUG

      public static void DEBUG(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
      debug log with exception stack
      Parameters:
      aStringToLog -
      aExceptionToLog -
      aThisInstance -
    • DEBUG

      public static void DEBUG(String aStringToLog, Object aThisInstance)
      debug log without exception stack
      Parameters:
      aStringToLog -
      aThisInstance -
    • INFO

      public static void INFO(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
      info log with exception stack
      Parameters:
      aStringToLog -
      aExceptionToLog -
      aThisInstance -
    • INFO

      public static void INFO(String aStringToLog, Object aThisInstance)
      info log without exception stack
      Parameters:
      aStringToLog -
      aThisInstance -
    • WARN

      public static void WARN(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
      warn log with exception stack
      Parameters:
      aStringToLog -
      aExceptionToLog -
      aThisInstance -
    • WARN

      public static void WARN(String aStringToLog, Object aThisInstance)
      warn log without exception stack
      Parameters:
      aStringToLog -
      aThisInstance -
    • ERROR

      public static void ERROR(String aStringToLog, Throwable aException, Object This)
      error log with exception stack
      Parameters:
      aStringToLog -
      aException -
      This -
    • FATAL

      public static void FATAL(String aStringToLog, Throwable aExceptionToLog, Object aThisInstance)
      fatal log with exception stack
      Parameters:
      aStringToLog -
      aExceptionToLog -
      aThisInstance -