Class Log
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidReport a P4Java-internal error to the log callback (if it exists).static voidReport a P4Java-internal unexpected exception to the log callback (if it exists).static ILogCallbackstatic voidReport a P4Java-internal informational event to the log callback (if it exists).static booleanisTracingAtLevel(ILogCallback.LogTraceLevel traceLevel) static ILogCallbacksetLogCallback(ILogCallback logCallback) Set the P4Java API's internal logger to log to the passed-in ILogCallback log callback.static voidReport a P4Java-internal statistics message to the log callback (if it exists).static voidtrace(ILogCallback.LogTraceLevel traceLevel, String traceMessage) Report a P4Java-internal trace message to the log callback (if it exists).static voidReport a P4Java-internal warning to the log callback (if it exists).
-
Constructor Details
-
Log
public Log()
-
-
Method Details
-
getLogCallback
- Returns:
- the current log callback, if any. May return null.
-
setLogCallback
Set the P4Java API's internal logger to log to the passed-in ILogCallback log callback. If the passed-in parameter is null, no logging will be performed. The caller is responsible for ensuring that there are not thread issues with the passed-in callback, and that callbacks to the callback object will not block or deadlock.- Parameters:
logCallback- callback to be used by P4Java to report log messages to; if null, stop logging.- Returns:
- the previous callback registered, or null if no such callback existed.
-
error
Report a P4Java-internal error to the log callback (if it exists).- Parameters:
errorString- non-null error string.args- args
-
warn
Report a P4Java-internal warning to the log callback (if it exists).- Parameters:
warnString- non-null warning message.args- args
-
info
Report a P4Java-internal informational event to the log callback (if it exists).- Parameters:
infoString- non-null info message.args- args
-
stats
Report a P4Java-internal statistics message to the log callback (if it exists).- Parameters:
statsString- non-null stats message.args- args
-
exception
Report a P4Java-internal unexpected exception to the log callback (if it exists).- Parameters:
thr- non-null Throwable
-
trace
Report a P4Java-internal trace message to the log callback (if it exists).- Parameters:
traceLevel- traceLeveltraceMessage- traceMessage
-
isTracingAtLevel
- Parameters:
traceLevel- traceLevel- Returns:
- true if the
-