Class REPLLog

java.lang.Object
de.uni_kiel.rz.fdr.repl.REPLLog

public class REPLLog extends Object
This class provides the means for logging messages to various targets. If Log4J is available in the current VM, it can also be used. cau-repl uses this class internally for its log messages, and you are encouraged to use it from your Groovy code as well.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The different targets that log messages can be written to.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<REPLLog.LOG_TARGETS>
    The default log targets for your messages: Log4J with a fallback to the standard error output and additionally cau-repl's own log file.
    static final Set<REPLLog.LOG_TARGETS>
    The log targets for internal log messages originating from cau-repl itself.
    static boolean
    Controls whether very fine-grained internal trace messages from cau-repl are logged.
    static boolean
    Controls whether very fine-grained internal trace messages from cau-repl related to compilation are logged.
    static boolean
    Controls whether very fine-grained internal trace messages from cau-repl related to methods during compilation are logged.
    static boolean
    Controls whether very fine-grained internal trace messages from cau-repl related to dynamization are logged.
    static boolean
    Controls whether very fine-grained internal trace messages from cau-repl related to jobs are logged.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    debug(Object... args)
    Log a new message with log level DEBUG to the default log targets.
    error(Object... args)
    Log a new message with log level ERROR to the default log targets.
    Gets all log entries from the repl's internal log file (which is rotated when the JVM starts).
    info(Object... args)
    Log a new message with log level INFO to the default log targets.
    static void
    Try to (re-)initialize optional external libraries.
    static void
    Log a given message to the default log targets.
    static void
    log(REPLLogEntry entry, Set<REPLLog.LOG_TARGETS> targets, PrintStream... streams)
    Log a given message.
    log(Object... args)
    Log a new message with log level INFO to the default log targets.
    trace(Object... args)
    Log a new message with log level TRACE to the trace log targets.
    warn(Object... args)
    Log a new message with log level WARN to the default log targets.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TRACE

      public static boolean TRACE
      Controls whether very fine-grained internal trace messages from cau-repl are logged. Do not enable in production.
    • TRACE_COMPILE

      public static boolean TRACE_COMPILE
      Controls whether very fine-grained internal trace messages from cau-repl related to compilation are logged. Enabling TRACE overrides this setting.
    • TRACE_COMPILE_METHODS

      public static boolean TRACE_COMPILE_METHODS
      Controls whether very fine-grained internal trace messages from cau-repl related to methods during compilation are logged. Enabling TRACE overrides this setting.
    • TRACE_DYNAMIZE

      public static boolean TRACE_DYNAMIZE
      Controls whether very fine-grained internal trace messages from cau-repl related to dynamization are logged. Enabling TRACE overrides this setting. Do not enable in production.
    • TRACE_JOBS

      public static boolean TRACE_JOBS
      Controls whether very fine-grained internal trace messages from cau-repl related to jobs are logged. Enabling TRACE overrides this setting. Do not enable in production.
    • DEFAULT_LOG_TARGETS

      public static final Set<REPLLog.LOG_TARGETS> DEFAULT_LOG_TARGETS
      The default log targets for your messages: Log4J with a fallback to the standard error output and additionally cau-repl's own log file.
    • INTERNAL_LOG_TARGETS

      public static final Set<REPLLog.LOG_TARGETS> INTERNAL_LOG_TARGETS
      The log targets for internal log messages originating from cau-repl itself.
  • Constructor Details

    • REPLLog

      public REPLLog()
  • Method Details

    • trace

      public static REPLLogEntry trace(Object... args)
      Log a new message with log level TRACE to the trace log targets.
      Parameters:
      args - The log messages. You an use the "{}" placeholder in the first argument to format the succeeding arguments.
      Returns:
      The log entry that was sent to the targets.
    • debug

      public static REPLLogEntry debug(Object... args)
      Log a new message with log level DEBUG to the default log targets.
      Parameters:
      args - The log messages. You an use the "{}" placeholder in the first argument to format the succeeding arguments.
      Returns:
      The log entry that was sent to the targets.
    • info

      public static REPLLogEntry info(Object... args)
      Log a new message with log level INFO to the default log targets.
      Parameters:
      args - The log messages. You an use the "{}" placeholder in the first argument to format the succeeding arguments.
      Returns:
      The log entry that was sent to the targets.
    • warn

      public static REPLLogEntry warn(Object... args)
      Log a new message with log level WARN to the default log targets.
      Parameters:
      args - The log messages. You an use the "{}" placeholder in the first argument to format the succeeding arguments.
      Returns:
      The log entry that was sent to the targets.
    • error

      public static REPLLogEntry error(Object... args)
      Log a new message with log level ERROR to the default log targets.
      Parameters:
      args - The log messages. You an use the "{}" placeholder in the first argument to format the succeeding arguments.
      Returns:
      The log entry that was sent to the targets.
    • log

      public static REPLLogEntry log(Object... args)
      Log a new message with log level INFO to the default log targets.
      Parameters:
      args - The log messages. You an use the "{}" placeholder in the first argument to format the succeeding arguments.
      Returns:
      The log entry that was sent to the targets.
    • log

      public static void log(REPLLogEntry entry)
      Log a given message to the default log targets.
      Parameters:
      entry - The message to log.
    • log

      public static void log(REPLLogEntry entry, Set<REPLLog.LOG_TARGETS> targets, PrintStream... streams)
      Log a given message.
      Parameters:
      entry - The message to log.
      targets - The log targets to write to.
      streams - Additional Print Streams to write to.
    • getLog

      public static List<REPLLogEntry> getLog()
      Gets all log entries from the repl's internal log file (which is rotated when the JVM starts). They will be read from disk, so this call might be slow if the log file is big.
      Returns:
      A list of all log entries from the repl's internal log file.
    • initializeLibs

      public static void initializeLibs()
      Try to (re-)initialize optional external libraries. At the moment, this pertains only to Log4J. Invoking this method will check whether it is installed and make it available as a logging target.