|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.Log
public class Log
Simple P4Java-wide logger class based on the ILogCallback callback interface. Useful for letting P4Java consumers report errors, warnings, etc., generated within P4Java into their own logs.
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 Summary | |
---|---|
Log()
|
Method Summary | |
---|---|
static void |
error(String errorString)
Report a P4Java-internal error to the log callback (if it exists). |
static void |
exception(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(String infoString)
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(String statsString)
Report a P4Java-internal statistics message to the log callback (if it exists). |
static void |
trace(ILogCallback.LogTraceLevel traceLevel,
String traceMessage)
Report a P4Java-internal trace message to the log callback (if it exists). |
static void |
warn(String warnString)
Report a P4Java-internal warning to the log callback (if it exists). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Log()
Method Detail |
---|
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(String errorString)
errorString
- non-null error string.public static void warn(String warnString)
warnString
- non-null warning message.public static void info(String infoString)
infoString
- non-null info message.public static void stats(String statsString)
statsString
- non-null stats message.public static void exception(Throwable thr)
thr
- non-null Throwablepublic static void trace(ILogCallback.LogTraceLevel traceLevel, String traceMessage)
public static boolean isTracingAtLevel(ILogCallback.LogTraceLevel traceLevel)
traceLevel
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |