Package com.gurock.smartinspect.packets
Class LogHeader
- java.lang.Object
-
- com.gurock.smartinspect.packets.Packet
-
- com.gurock.smartinspect.packets.LogHeader
-
public class LogHeader extends Packet
Represents the Log Header packet type which is used for storing and transferring log metadata.The LogHeader class is used to store and transfer log metadata. After the PipeProtocol or TcpProtocol has established a connection, a Log Header packet with the metadata of the current logging context is created and written. Log Header packets are used by the SmartInspect Router application for its filter and trigger functionality.
This class is not guaranteed to be threadsafe. However, instances of this class will normally only be used in the context of a single thread.
-
-
Field Summary
-
Fields inherited from class com.gurock.smartinspect.packets.Packet
PACKET_HEADER
-
-
Constructor Summary
Constructors Constructor Description LogHeader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValue(String key, String value)Adds a key-value pair to this Log Header packet.StringgetContent()Returns the entire content of this Log Header packet.PacketTypegetPacketType()Overridden.intgetSize()Overridden.-
Methods inherited from class com.gurock.smartinspect.packets.Packet
getBytes, getLevel, getStringSize, getThreadId, isThreadSafe, lock, setBytes, setLevel, setThreadSafe, unlock
-
-
-
-
Method Detail
-
getSize
public int getSize()
Overridden. Returns the total occupied memory size of this Log Header packet. The total occupied memory size of this Log Header is the size of memory occupied by all strings and any internal data structures of this Log Header.
-
getPacketType
public PacketType getPacketType()
Overridden. Returns PacketType.LogHeader.- Specified by:
getPacketTypein classPacket- Returns:
- Just PacketType.LogHeader. For a complete list of available packet types, please have a look at the documentation of the PacketType type
-
getContent
public String getContent()
Returns the entire content of this Log Header packet. The content of a Log Header packet is a key-value (syntax: key=value) list of the properties of this Log Header packet (currently only the getAppName and the getHostName strings). Key-value pairs are separated by carriage return and newline characters.- Returns:
- The entire content of this Log Header packet
-
addValue
public void addValue(String key, String value)
Adds a key-value pair to this Log Header packet. If the key already exists, its value is overwritten with the provided value.- Parameters:
key- The key to be associated with the specified valuevalue- The value to be associated with the specified key
-
-