public class Log
extends java.lang.Object
Note that absolutely no guarantees or specifications are made about the format or content of strings that are passed through the logging mechanism, but in general all such strings are useful for Perforce support staff, and many info and stats strings passed to the callback may be generally useful for API consumers.
The Log class is itself used from within P4Java to report log messages; the intention here is to allow consumers to call the setLogCallback static method with a suitable log listener that the P4Java API will log to internally. Most of the methods below besides the setLogCallback method are mainly intended for API-internal use, but participating apps may find the other methods useful for interpolating marker text or other messages to the API's log.
Constructor and Description |
---|
Log() |
Modifier and Type | Method and Description |
---|---|
static void |
error(java.lang.String errorString,
java.lang.Object... args)
Report a P4Java-internal error to the log callback (if it exists).
|
static void |
exception(java.lang.Throwable thr)
Report a P4Java-internal unexpected exception to the log callback
(if it exists).
|
static ILogCallback |
getLogCallback()
Get the current log callback, if any.
|
static void |
info(java.lang.String infoString,
java.lang.Object... args)
Report a P4Java-internal informational event to the log callback (if it exists).
|
static boolean |
isTracingAtLevel(ILogCallback.LogTraceLevel traceLevel)
Return true if the
|
static ILogCallback |
setLogCallback(ILogCallback logCallback)
Set the P4Java API's internal logger to log to the passed-in
ILogCallback log callback.
|
static void |
stats(java.lang.String statsString,
java.lang.Object... args)
Report a P4Java-internal statistics message to the log callback (if it exists).
|
static void |
trace(ILogCallback.LogTraceLevel traceLevel,
java.lang.String traceMessage)
Report a P4Java-internal trace message to the log callback
(if it exists).
|
static void |
warn(java.lang.String warnString,
java.lang.Object... args)
Report a P4Java-internal warning to the log callback (if it exists).
|
public static ILogCallback getLogCallback()
public static ILogCallback setLogCallback(ILogCallback logCallback)
logCallback
- callback to be used by P4Java to report log messages to; if null, stop
logging.public static void error(java.lang.String errorString, @Nullable java.lang.Object... args)
errorString
- non-null error string.public static void warn(java.lang.String warnString, @Nullable java.lang.Object... args)
warnString
- non-null warning message.public static void info(java.lang.String infoString, @Nullable java.lang.Object... args)
infoString
- non-null info message.public static void stats(java.lang.String statsString, @Nullable java.lang.Object... args)
statsString
- non-null stats message.public static void exception(java.lang.Throwable thr)
thr
- non-null Throwablepublic static void trace(ILogCallback.LogTraceLevel traceLevel, java.lang.String traceMessage)
public static boolean isTracingAtLevel(ILogCallback.LogTraceLevel traceLevel)
Copyright © 2018 Perforce Software. All Rights Reserved.