Package de.uni_kiel.rz.fdr.repl
Class REPLLog
java.lang.Object
de.uni_kiel.rz.fdr.repl.REPLLog
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 ClassesModifier and TypeClassDescriptionstatic enum
The different targets that log messages can be written to. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic REPLLogEntry
Log a new message with log levelDEBUG
to the default log targets.static REPLLogEntry
Log a new message with log levelERROR
to the default log targets.static List<REPLLogEntry>
getLog()
Gets all log entries from the repl's internal log file (which is rotated when the JVM starts).static REPLLogEntry
Log a new message with log levelINFO
to the default log targets.static void
Try to (re-)initialize optional external libraries.static void
log
(REPLLogEntry entry) 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.static REPLLogEntry
Log a new message with log levelINFO
to the default log targets.static REPLLogEntry
Log a new message with log levelTRACE
to the trace log targets.static REPLLogEntry
Log a new message with log levelWARN
to the default log targets.
-
Field Details
-
TRACE
public static boolean TRACEControls whether very fine-grained internal trace messages from cau-repl are logged. Do not enable in production. -
TRACE_COMPILE
public static boolean TRACE_COMPILEControls whether very fine-grained internal trace messages from cau-repl related to compilation are logged. EnablingTRACE
overrides this setting. -
TRACE_COMPILE_METHODS
public static boolean TRACE_COMPILE_METHODSControls whether very fine-grained internal trace messages from cau-repl related to methods during compilation are logged. EnablingTRACE
overrides this setting. -
TRACE_DYNAMIZE
public static boolean TRACE_DYNAMIZEControls whether very fine-grained internal trace messages from cau-repl related to dynamization are logged. EnablingTRACE
overrides this setting. Do not enable in production. -
TRACE_JOBS
public static boolean TRACE_JOBSControls whether very fine-grained internal trace messages from cau-repl related to jobs are logged. EnablingTRACE
overrides this setting. Do not enable in production. -
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
The log targets for internal log messages originating from cau-repl itself.
-
-
Constructor Details
-
REPLLog
public REPLLog()
-
-
Method Details
-
trace
Log a new message with log levelTRACE
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
Log a new message with log levelDEBUG
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
Log a new message with log levelINFO
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
Log a new message with log levelWARN
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
Log a new message with log levelERROR
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
Log a new message with log levelINFO
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
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
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.
-