Package com.cognex.cmbsdk.interfaces
Interface Logger
public interface Logger
Interface definition for a logger object to be used for logging important events and/or
traffic between the remote system and the SDK.
-
Method Summary
Modifier and TypeMethodDescriptionintReturns a unique id that can be used to track logs and traffic data of one session.booleanIndicates whether logging is enabled or not.voidWrites a log entry.voidWrites a log entry with exception trace.voidlogTraffic(int sessionId, boolean isRead, byte[] buffer, int offset, int count) Logs a read or write operation.voidsetEnabled(boolean enabled) Enables or disables logging.
-
Method Details
-
isEnabled
boolean isEnabled()Indicates whether logging is enabled or not.- Returns:
trueif logging is enabled, otherwisefalse.
-
setEnabled
void setEnabled(boolean enabled) Enables or disables logging.- Parameters:
enabled-trueto enable logging,falseotherwise.
-
getNextUniqueSessionId
int getNextUniqueSessionId()Returns a unique id that can be used to track logs and traffic data of one session. This method is called by theDataManSystemobject when a connection is being established.- Returns:
- A new unique id that can be used to distinguish logs and traffic data of different communication sessions.
-
log
Writes a log entry.- Parameters:
function- Name of the function for which the log entry is created.message- The log message.
-
log
Writes a log entry with exception trace.- Parameters:
function- Name of the function for which the log entry is created.message- The log message.exception- The exception object to trace
-
logTraffic
void logTraffic(int sessionId, boolean isRead, byte[] buffer, int offset, int count) Logs a read or write operation.- Parameters:
sessionId- The unique id of the session to which this log belong.isRead-truein case of a read operation,falsein case of a write operation.buffer- Buffer that contains the bytes that were read/written.offset- Offset in the buffer to log from.count- Number of bytes to write to the log from the buffer.
-