类 DebugService

java.lang.Object
pkg.exoad.poprock.core.debug.DebugService

@ServiceClass(requiresArming=false) public final class DebugService extends Object
Debug Service - Utility class for handling various exceptions that can be thrown during the runtime of this program.
Most of the things occuring here like throwing errors should only happen in development. This is especially the case because the hints provided are only able to.
作者:
Jack Meng
  • 字段详细资料

    • logMessageFormat

      public static String logMessageFormat
      If you wish to edit this. The format defines the following tags:
      • {0} denotes the DebugService.LogLevel
      • {1} denotes the time invoked in mm/dd/yy HH:MM:SS format
      • {2} denotes the part where the message of the log entry will be shown
    • logTimeStampFormat

      public static String logTimeStampFormat
      If you wish to edit this, it must follow the format accepted by SimpleDateFormat
    • out

      private static volatile PrintStream out
    • USE_PANIC

      private static boolean USE_PANIC
    • USE_CUSTOM_STACK_TRACE

      private static boolean USE_CUSTOM_STACK_TRACE
  • 构造器详细资料

    • DebugService

      private DebugService()
  • 方法详细资料

    • allowCustomStackTrace

      public static void allowCustomStackTrace(boolean b)
      Sets whether any panic messages or other messages for exceptions and errors are thrown to the print stream with a customized stack trace.

      This option only exists to reduce cluster in pre existing exceptions

      参数:
      b - on or off
    • isUsingCustomStackTraces

      public static boolean isUsingCustomStackTraces()
      Whether the debug service is using custom stack traces for panicking
      返回:
      true or false
    • allowPanicking

      public static void allowPanicking(boolean b)
      Sets whether any functions depending on any of the DebugService's panic functions will not be able to emit anything.

      THIS IS A VERY DANGEROUS METHOD, JUST LEAVE IT ON!!

      参数:
      b - on or off
    • canPanic

      public static boolean canPanic()
      Whether the debug service is allowed to panic the current program. Most of the time this is set to true unless allowPanicking(boolean) is modified.
      返回:
      true or false
    • info

      public static void info(Object msg)
      Macro call for DebugService.log(LogLevel.INFO,...)
      参数:
      msg - message
    • log

      public static void log(DebugService.LogLevel level, Object msg)
      Logs a message to the console with the specified level
      参数:
      level - The level of the log
      msg - The message to log
    • getOut

      public static PrintStream getOut()
      返回:
      The internal output stream used by this debug service
    • setOut

      public static void setOut(PrintStream p)
      Sets the internal output stream used by this debug service
      参数:
      p - The new output stream
    • warn

      public static void warn(Object msg)
      Macro call for DebugService.log(LogLevel.WARN,...)
      参数:
      msg - message
    • note

      public static void note(Object msg)
      Macro call for DebugService.log(LogLevel.NOTE,...)
      参数:
      msg - message
    • panicNow

      @ProgramInvoked public static void panicNow(String message)
      Tells the debug service to prepare an exception right now because of an internal error. Also note this is a synchronized method meaning only ONE thread may call it at a time.
      参数:
      message - The error message. THIS SHOULD NOT BE AUTOMATICALLY GENERATED
    • panicOn

      public static void panicOn(boolean condition, String message)
      Tells the debug service to prepare an exception ONLY IF the condition passed returns TRUE
      参数:
      condition - The condition
      message - The message. THIS SHOULD NOT BE AUTOMATICALLY GENERATED. [This is usually the hint given to a programmer]
    • modifyThrowable

      public static RuntimeException modifyThrowable(Throwable throwable)
    • panicWith

      public static void panicWith(Throwable e)
      Instructs the service to kill the current program with a runtime exception and another exception or throwable provided.
      参数:
      e - The other provided throwable
    • panicWith

      public static void panicWith(Thread t, Throwable e)
    • panicOn

      public static void panicOn(boolean condition, String message, Throwable cause)
      Similar to panicOn(boolean,String) but instead you can also pass a related cause of this exception.
      参数:
      condition - The condition
      message - The message
      cause - The related caused exception
      另请参阅: