Package ghidra.app.util.importer
Class MessageLog
- java.lang.Object
-
- ghidra.app.util.importer.MessageLog
-
- Direct Known Subclasses:
XmlMessageLog
public class MessageLog extends java.lang.Object
A simple class to handle logging messages and exceptions. A maximum message count size constraint can be set to clip messages after a certain number, but still keep incrementing a running total.In addition to logging messages, clients can also set a status message. This message may later used as the primary error message when reporting to the user.
-
-
Constructor Summary
Constructors Constructor Description MessageLog()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
appendException(java.lang.Throwable t)
Appends the exception to the logvoid
appendMsg(int lineNum, java.lang.String message)
Appends the message and line number to the logvoid
appendMsg(java.lang.String message)
Appends the message to the logvoid
appendMsg(java.lang.String originator, java.lang.String message)
Appends the message to the logvoid
clear()
Clears all messages from this log and resets the countvoid
clearStatus()
Clear status messagevoid
copyFrom(MessageLog log)
Copies the contents of one message log into this onevoid
error(java.lang.String originator, java.lang.String message)
Deprecated.java.lang.String
getStatus()
Returns a stored status messageboolean
hasMessages()
Returns true if this log has messagesvoid
setStatus(java.lang.String status)
Stores a status message that can be used elsewhere (i.e., populate warning dialogs)java.lang.String
toString()
void
write(java.lang.Class<?> owner, java.lang.String messageHeader)
Writes this log's contents to the application log
-
-
-
Method Detail
-
copyFrom
public void copyFrom(MessageLog log)
Copies the contents of one message log into this one- Parameters:
log
- the log to copy from
-
appendMsg
public void appendMsg(java.lang.String message)
Appends the message to the log- Parameters:
message
- the message
-
appendMsg
public void appendMsg(java.lang.String originator, java.lang.String message)
Appends the message to the log- Parameters:
originator
- the originator of the messagemessage
- the message
-
appendMsg
public void appendMsg(int lineNum, java.lang.String message)
Appends the message and line number to the log- Parameters:
lineNum
- the line number that generated the messagemessage
- the message
-
appendException
public void appendException(java.lang.Throwable t)
Appends the exception to the log- Parameters:
t
- the exception to append to the log
-
error
@Deprecated public void error(java.lang.String originator, java.lang.String message)
Deprecated.Readable method for appending error messages to the log.Currently does nothing different than
appendMsg(String, String)
.- Parameters:
originator
- the originator of the messagemessage
- the message
-
hasMessages
public boolean hasMessages()
Returns true if this log has messages- Returns:
- true if this log has messages
-
clear
public void clear()
Clears all messages from this log and resets the count
-
setStatus
public void setStatus(java.lang.String status)
Stores a status message that can be used elsewhere (i.e., populate warning dialogs)- Parameters:
status
- the status message
-
clearStatus
public void clearStatus()
Clear status message
-
getStatus
public java.lang.String getStatus()
Returns a stored status message- Returns:
- stored status message
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
write
public void write(java.lang.Class<?> owner, java.lang.String messageHeader)
Writes this log's contents to the application log- Parameters:
owner
- the owning class whose name will appear in the log messagemessageHeader
- the message header that will appear before the log messages
-
-