com.kuka.common
Class DataLogger

java.lang.Object
  extended by com.kuka.common.DataLogger

public final class DataLogger
extends Object

Utility class that provides a queue for binary data to be logged as hex dump on request at a later time. The recording and logging methods will return immediately without locking or copying data if the logging level for this class's logger isn't set to a value greater than TRACE. The logger's name is .


Field Summary
static int DEFAULT_QUEUE_LENGTH
          The default data queue length.
static String LOGGER_NAME
          The name of the logger used for data logging.
 
Method Summary
static void logRecordedData()
          Logs the recorded data in hex dump format and empties the data queue, if the logging level is set to trace.
static void recordData(byte[] data)
          Copies the given data into the queue for later logging, if the logging level is set to trace.
static void recordData(byte[] data, int offset, int length)
          Copies the given data into the queue for later logging, if the logging level is set to trace.
static void setQueueLength(int length)
          Logs all existing data and resets the queue to the given length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER_NAME

public static final String LOGGER_NAME
The name of the logger used for data logging.


DEFAULT_QUEUE_LENGTH

public static final int DEFAULT_QUEUE_LENGTH
The default data queue length.

See Also:
Constant Field Values
Method Detail

setQueueLength

public static void setQueueLength(int length)
Logs all existing data and resets the queue to the given length.

Parameters:
length - the new queue length

recordData

public static void recordData(byte[] data)
Copies the given data into the queue for later logging, if the logging level is set to trace. Otherwise this function immediately returns.

Parameters:
data - the data to log.
See Also:
recordData(byte[], int, int)

recordData

public static void recordData(byte[] data,
                              int offset,
                              int length)
Copies the given data into the queue for later logging, if the logging level is set to trace. Otherwise this function immediately returns after checking the offset for validity.

Parameters:
data - the data to log
offset - the offset from which to start the logging
length - the total number of bytes to log
Throws:
ArrayIndexOutOfBoundsException - if offset is negative, or greater or equal data.length

logRecordedData

public static void logRecordedData()
Logs the recorded data in hex dump format and empties the data queue, if the logging level is set to trace. Otherwise this function immediately returns.

See Also:
CommonUtil.printHexDump(PrintWriter, byte[], int, int)


Copyright © 2019. All rights reserved.