public final class LogEntry extends Packet
A Log Entry is the most important packet available in the SmartInspect concept. It is used for almost all logging methods in the Session class, like, for example, Session.logMessage, Session.logObject or Session.logSql.
A Log Entry has several properties which describe its creation context (like a thread ID, timestamp or hostname) and other properties which specify the way the Console interprets this packet (like the viewer ID or the background color). Furthermore a Log Entry contains the actual data which will be displayed in the Console.
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.
PACKET_HEADER| Constructor and Description |
|---|
LogEntry()
Overloaded.
|
LogEntry(LogEntryType logEntryType,
ViewerId viewerId)
Overloaded.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAppName()
Returns the application name of this Log Entry.
|
Color |
getColor()
Returns the background color of this Log Entry.
|
byte[] |
getData()
Returns the optional data block of the Log Entry.
|
String |
getHostName()
Returns the hostname of this Log Entry.
|
LogEntryType |
getLogEntryType()
Returns the type of this Log Entry.
|
PacketType |
getPacketType()
Overridden.
|
int |
getProcessId()
Returns the process ID of this LogEntry object.
|
String |
getSessionName()
The session name of a Log Entry is normally set to the name of
the session which sent this Log Entry.
|
int |
getSize()
Overridden.
|
int |
getThreadId()
Returns the thread ID of this LogEntry object.
|
long |
getTimestamp()
Returns the timestamp of this LogEntry object.
|
String |
getTitle()
Returns the title of this Log Entry.
|
ViewerId |
getViewerId()
Returns the viewer ID of this Log Entry.
|
void |
setAppName(String appName)
Sets the application name of this Log Entry.
|
void |
setColor(Color color)
Sets the background color of this Log Entry.
|
void |
setData(byte[] data)
Sets the optional data block of this Log Entry.
|
void |
setHostName(String hostName)
Sets the hostname of this Log Entry.
|
void |
setLogEntryType(LogEntryType logEntryType)
Sets the type of this Log Entry.
|
void |
setProcessId(int processId)
Sets the process ID of this LogEntry object.
|
void |
setSessionName(String sessionName)
Sets the session name of the Log Entry.
|
void |
setThreadId(int threadId)
Sets the thread ID of this LogEntry object.
|
void |
setTimestamp(long timestamp)
Sets the timestamp of this LogEntry object.
|
void |
setTitle(String title)
Sets the title of this Log Entry.
|
void |
setViewerId(ViewerId viewerId)
Sets the viewer ID of this Entry.
|
getBytes, getLevel, getStringSize, isThreadSafe, lock, setBytes, setLevel, setThreadSafe, unlockpublic LogEntry()
public LogEntry(LogEntryType logEntryType, ViewerId viewerId)
If the logEntryType or viewerId argument is a null reference a NullPointerException will be thrown.
logEntryType - The type of the new Log Entry describes the way the Console
interprets this packet. Please see the LogEntryType type for more
information. Not allowed to be nullviewerId - The viewer ID of the new Log Entry describes which viewer
should be used in the Console when displaying the data of
this Log Entry. Please see ViewerId for more information.
Not allowed to be nullNullPointerException - if the logEntryType or viewerId argument
is nullpublic int getSize()
The total occupied memory size of this Log Entry is the size of memory occupied by all strings, the optional data block and any internal data structures of this Log Entry.
public PacketType getPacketType()
getPacketType in class Packetpublic String getTitle()
public void setTitle(String title)
The title of this Log Entry will be empty in the SmartInspect Console when this method gets a null reference as argument.
title - The new title of this Log Entry. Can be nullpublic String getSessionName()
This method can return null if this Log Entry does not contain a session name. If this is the case, the session name will be empty in the SmartInspect Console.
Returns the session name of the Log Entry.
public void setSessionName(String sessionName)
The session name of this Log Entry will be empty in the SmartInspect Console when this method gets a null reference as argument.
sessionName - The new session name of this Log Entry. Can be nullpublic String getHostName()
The hostname of a Log Entry is usually set to the name of the machine this Log Entry is sent from. This method can return null if this Log Entry does not contain a hostname. If this is the case, the hostname will be empty in the SmartInspect Console.
public void setHostName(String hostName)
The hostname of this Log Entry will be empty in the SmartInspect Console when this method gets a null reference as argument.
hostName - The new hostname of this Log Entry. Can be nullpublic String getAppName()
The application name of a Log Entry is usually set to the name of the application this Log Entry is created in.
This method can return null if this Log Entry does not contain an application name. If this is the case, the application name will be empty in the SmartInspect Console.
public void setAppName(String appName)
The application name of this Log Entry will be empty in the SmartInspect Console when this method gets a null reference as argument.
appName - The new application name of this Log Entry. Can be nullpublic LogEntryType getLogEntryType()
public void setLogEntryType(LogEntryType logEntryType)
The type of this Log Entry describes the way the Console interprets this packet. Please see the LogEntryType enum for more information. If the logEntryType argument is a null reference a NullPointerException will be thrown.
logEntryType - The new type of this Log Entry. Not allowed to be nullNullPointerException - If the logEntryType argument is nullpublic ViewerId getViewerId()
public void setViewerId(ViewerId viewerId)
The viewer ID of the Log Entry describes which viewer should be used in the Console when displaying the data of this Log Entry. Please see the ViewerId enum for more information.
If the viewerId argument is a null reference a NullPointerException will be thrown.
viewerId - The new viewer ID of this Log Entry. Not allowed to be nullNullPointerException - if the viewerId argument is nullpublic Color getColor()
public void setColor(Color color)
This Log Entry uses the default background color in the SmartInspect Console when this method gets a null reference as argument.
color - The new background color of this Log Entry. Can be nullpublic byte[] getData()
This method can return null if this Log Entry does not contain additional data.
Important: Treat the returned array as read-only. This means, modifying this array in any way is not supported.
public void setData(byte[] data)
Because of the fact that the data block of a Log Entry is optional, it is allowed to pass a null reference.
Important: Treat the passed array as read-only. This means, modifying this array in any way after passing it to this method is not supported.
data - The new data block of this Log Entry. Can be nullpublic long getTimestamp()
public void setTimestamp(long timestamp)
timestamp - The new timestamp of this LogEntry object. The passed value should represent
the local date and time in microseconds since January 1, 1970. See SmartInspect.now() for more information.public int getProcessId()
public void setProcessId(int processId)
processId - The new process ID of this LogEntry objectpublic int getThreadId()
getThreadId in class Packetpublic void setThreadId(int threadId)
threadId - The new thread ID of this Log Entry objectCopyright © 2023. All rights reserved.