Class DebugTrace

java.lang.Object
org.debugtrace.DebugTrace

public class DebugTrace extends Object
Contains the main static methods of DebugTrace.
Since:
1.0.0
Author:
Masato Kokubo
  • Field Details

    • VERSION

      public static final String VERSION
      DebugTrace version string
      Since:
      3.0.0
      See Also:
    • enterFormat

      protected static String enterFormat
    • leaveFormat

      protected static String leaveFormat
    • threadBoundaryFormat

      protected static String threadBoundaryFormat
    • classBoundaryFormat

      protected static String classBoundaryFormat
    • indentString

      protected static String indentString
    • dataIndentString

      protected static String dataIndentString
    • limitString

      protected static String limitString
    • nonOutputString

      protected static String nonOutputString
    • cyclicReferenceString

      protected static String cyclicReferenceString
    • varNameValueSeparator

      protected static String varNameValueSeparator
    • keyValueSeparator

      protected static String keyValueSeparator
    • printSuffixFormat

      protected static String printSuffixFormat
    • sizeFormat

      protected static String sizeFormat
    • minimumOutputSize

      protected static int minimumOutputSize
    • lengthFormat

      protected static String lengthFormat
    • minimumOutputLength

      protected static int minimumOutputLength
    • utilDateFormat

      protected static String utilDateFormat
    • sqlDateFormat

      protected static String sqlDateFormat
    • timeFormat

      protected static String timeFormat
    • timestampFormat

      protected static String timestampFormat
    • localDateFormat

      protected static String localDateFormat
    • localTimeFormat

      protected static String localTimeFormat
    • offsetTimeFormat

      protected static String offsetTimeFormat
    • localDateTimeFormat

      protected static String localDateTimeFormat
    • offsetDateTimeFormat

      protected static String offsetDateTimeFormat
    • zonedDateTimeFormat

      protected static String zonedDateTimeFormat
    • instantFormat

      protected static String instantFormat
    • logDateTimeFormat

      protected static String logDateTimeFormat
    • timeZone

      protected static String timeZone
    • maximumDataOutputWidth

      protected static int maximumDataOutputWidth
    • collectionLimit

      protected static int collectionLimit
    • byteArrayLimit

      protected static int byteArrayLimit
    • stringLimit

      protected static int stringLimit
    • reflectionNestLimit

      protected static int reflectionNestLimit
    • nonOutputProperties

      protected static List<String> nonOutputProperties
    • defaultPackage

      protected static String defaultPackage
    • defaultPackageString

      protected static String defaultPackageString
    • reflectionClassPaths

      protected static Set<String> reflectionClassPaths
    • reflectionClasses

      protected static Set<Class<?>> reflectionClasses
    • nonReflectionClasses

      protected static Set<Class<?>> nonReflectionClasses
    • mapNameMap

      protected static Map<String,String> mapNameMap
  • Method Details

    • initClass

      public static void initClass()
      Initializes this class.
      Since:
      3.0.0
    • initClass

      public static void initClass(String baseName)
      Initializes this class.
      Parameters:
      baseName - the base name of the resource properties file
      Since:
      3.0.0
    • appendTimestamp

      public static String appendTimestamp(String string)
      Append a timestamp to the head of the string.
      This method is used internally.
      Parameters:
      string - a string
      Returns:
      a string appended a timestamp string
    • isEnabled

      public static boolean isEnabled()
      Returns whether tracing is enabled.
      Returns:
      true if tracing is enabled; false otherwise
    • enter

      public static void enter()
      Call this method at entrance of your methods.
    • leave

      public static void leave()
      Call this method at exit of your methods.
    • print

      public static String print(String message)
      Outputs the message to the log.
      Parameters:
      message - a message
      Returns:
      the message
    • print

      public static String print(Supplier<String> messageSupplier)
      Outputs a message to the log.
      Parameters:
      messageSupplier - a message supplier
      Returns:
      the message if isEnabled(), otherwise null
    • print

      public static boolean print(String name, boolean value)
      Outputs the name and the boolean value to the log.
      Parameters:
      name - the name of the value
      value - the boolean value to output
      Returns:
      the value
    • print

      public static boolean print(String name, boolean value, LogOptions logOptions)
      Outputs the name and the boolean value to the log.
      Parameters:
      name - the name of the value
      value - the boolean value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static char print(String name, char value)
      Outputs the name and the char value to the log.
      Parameters:
      name - the name of the value
      value - the char value to output
      Returns:
      the value
    • print

      public static char print(String name, char value, LogOptions logOptions)
      Outputs the name and the char value to the log.
      Parameters:
      name - the name of the value
      value - the char value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static byte print(String name, byte value)
      Outputs the name and the byte value to the log.
      Parameters:
      name - the name of the value
      value - the byte value to output
      Returns:
      the value
    • print

      public static byte print(String name, byte value, LogOptions logOptions)
      Outputs the name and the byte value to the log.
      Parameters:
      name - the name of the value
      value - the byte value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static short print(String name, short value)
      Outputs the name and the short value to the log.
      Parameters:
      name - the name of the value
      value - the short value to output
      Returns:
      the value
    • print

      public static short print(String name, short value, LogOptions logOptions)
      Outputs the name and the short value to the log.
      Parameters:
      name - the name of the value
      value - the short value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static int print(String name, int value)
      Outputs the name and the int value to the log.
      Parameters:
      name - the name of the value
      value - the int value to output
      Returns:
      the value
    • print

      public static int print(String name, int value, LogOptions logOptions)
      Outputs the name and the int value to the log.
      Parameters:
      name - the name of the value
      value - the int value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static long print(String name, long value)
      Outputs the name and the long value to the log.
      Parameters:
      name - the name of the value
      value - the long value to output
      Returns:
      the value
    • print

      public static long print(String name, long value, LogOptions logOptions)
      Outputs the name and the long value to the log.
      Parameters:
      name - the name of the value
      value - the long value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static float print(String name, float value)
      Outputs the name and the value to the log.
      Parameters:
      name - the name of the value
      value - the float value to output
      Returns:
      the value
    • print

      public static float print(String name, float value, LogOptions logOptions)
      Outputs the name and the value to the log.
      Parameters:
      name - the name of the value
      value - the float value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static double print(String name, double value)
      Outputs the name and the value to the log.
      Parameters:
      name - the name of the value
      value - the double value to output
      Returns:
      the value
    • print

      public static double print(String name, double value, LogOptions logOptions)
      Outputs the name and the value to the log.
      Parameters:
      name - the name of the value
      value - the double value to output
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static <T> T print(String name, T value)
      Outputs the name and the value to the log.
      Type Parameters:
      T - the type of the value
      Parameters:
      name - the name of the value
      value - the value to output (accept null)
      Returns:
      the value
    • print

      public static <T> T print(String name, T value, LogOptions logOptions)
      Outputs the name and the value to the log.
      Type Parameters:
      T - the type of the value
      Parameters:
      name - the name of the value
      value - the value to output (accept null)
      logOptions - LogOptions
      Returns:
      the value
      Since:
      3.7.0
    • print

      public static boolean print(String name, BooleanSupplier valueSupplier)
      Outputs the name and the boolean value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of boolean value to output
      Returns:
      the value if isEnabled(), otherwise false
    • print

      public static boolean print(String name, BooleanSupplier valueSupplier, LogOptions logOptions)
      Outputs the name and the boolean value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of boolean value to output
      logOptions - LogOptions
      Returns:
      the value if isEnabled(), otherwise false
      Since:
      3.7.0
    • print

      public static int print(String name, IntSupplier valueSupplier)
      Outputs the name and the int value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of int value to output
      Returns:
      the value if isEnabled(), otherwise 0
    • print

      public static int print(String name, IntSupplier valueSupplier, LogOptions logOptions)
      Outputs the name and the int value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of int value to output
      logOptions - LogOptions
      Returns:
      the value if isEnabled(), otherwise 0
      Since:
      3.7.0
    • print

      public static long print(String name, LongSupplier valueSupplier)
      Outputs the name and the long value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of long value to output
      Returns:
      the value if isEnabled(), otherwise 0L
    • print

      public static long print(String name, LongSupplier valueSupplier, LogOptions logOptions)
      Outputs the name and the long value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of long value to output
      logOptions - LogOptions
      Returns:
      the value if isEnabled(), otherwise 0L
      Since:
      3.7.0
    • print

      public static double print(String name, DoubleSupplier valueSupplier)
      Outputs the name and the double value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of double value to output
      Returns:
      the value if isEnabled(), otherwise 0.0
    • print

      public static double print(String name, DoubleSupplier valueSupplier, LogOptions logOptions)
      Outputs the name and the double value to the log.
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of double value to output
      logOptions - LogOptions
      Returns:
      the value if isEnabled(), otherwise 0.0
      Since:
      3.7.0
    • print

      public static <T> T print(String name, Supplier<T> valueSupplier)
      Outputs the name and the value to the log.
      Type Parameters:
      T - the type of the value
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of value to output
      Returns:
      the value if isEnabled(), otherwise null
    • print

      public static <T> T print(String name, Supplier<T> valueSupplier, LogOptions logOptions)
      Outputs the name and the value to the log.
      Type Parameters:
      T - the type of the value
      Parameters:
      name - the name of the value
      valueSupplier - the supplier of value to output
      logOptions - LogOptions
      Returns:
      the value if isEnabled(), otherwise null
      Since:
      3.7.0
    • printStack

      public static void printStack(int maxCount)
      Outputs a list of StackTraceElements to the log.
      Parameters:
      maxCount - maximum number of stack trace elements to output
    • getLastLog

      public static String getLastLog()
      Returns the last log string output.
      Returns:
      the last log string output.
      Since:
      2.4.0