|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lapetus_ltd.api.common.logger.TLptsLog
public class TLptsLog
Class Description : This is the log class used to contain a single log.
TLptsLogger.setRecipientId(int)
then
ILptsLogListener
.
Constructor Summary | |
---|---|
TLptsLog(TLptsLogger.LOG_TYPE type,
java.lang.String message,
java.lang.String supportingText,
java.lang.Exception exception,
int id)
This is the Constructor for the TLptsLog class. |
Method Summary | |
---|---|
java.lang.Exception |
getException()
Gets the Exception of the TLptsLog. |
java.lang.String |
getExceptionMessage()
Gets the message of the Exception. |
int |
getId()
Gets the current ID set by TLptsLogger.setRecipientId(int) . |
java.lang.String |
getMessage()
Gets the message set by the application for the log. |
java.lang.String |
getSupportingText()
Gets the support text set by the application. |
java.sql.Timestamp |
getTimestamp()
Gets the timeStamp of the log. |
TLptsLogger.LOG_TYPE |
getType()
Gets the type of the Log. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TLptsLog(TLptsLogger.LOG_TYPE type, java.lang.String message, java.lang.String supportingText, java.lang.Exception exception, int id)
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : No.
Notes : the application should call TLptsLogger.logError(java.lang.String, java.lang.Exception)
or the other logXXX functions to generate a log.
It is not recommended to create the log ourselves, using the constructor.
Example :
try { // Doing something here that throws and exception. } catch (Exception e) { // Something unexpected happened and the application caught it. TLptsLogger.logError("The application threw an exception.",e); } ... // In one of the listeners of the logger public class TLogListener implements ILptsLogListener { void newLogGenerated(TLptsLog log) { //Every time TLptsLogger catches an exception, it creates a new TLptsLog() //This TLptsLog contains all the information we want for that exception. //First we can determine the type of the TLptsLog (Error,Message,Debug,Warning,Reset) if (log.getType()==TLptsLogger.LOG_TYPE.ERROR) { System.out.println("Error ID: " + log.getId()); //TLptsLog contains the text message we set when we catch the exception System.out.println("Error logger: " + log.getMessage()); //Also contains the message of the exception System.out.println("Exception message: " + log.getExceptionMessage()); //The application also sets a support text System.out.println("Supporting Text: " + log.getSupportingText()); // With getTimestamp we can identify the exact time of the log (down to milliseconds) System.out.println("Time : " + log.getTimestamp()); //Finally the TLptsLog contains the object of the Exception. processException(log.getException()); } } }
type
- is the Type of the Exception (Error,Message,Debug,Warning,Reset)message
- The message for the logsupportingText
- Support text for the logexception
- The exception objectid
- The recipient ID for filtering (default is 0 from TLptsLogger)Method Detail |
---|
public java.lang.Exception getException()
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : Yes.
Notes : If the log is generated from an EXCEPTION, then that will be included here.
Example :
Refer to example in constructor TLptsLog
.
public java.lang.String getExceptionMessage()
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : No. Empty String in worst case.
Notes :
Example :
Refer to example in constructor TLptsLog
.
public int getId()
Gets the current ID set by TLptsLogger.setRecipientId(int)
.
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : Yes.
Notes : Use this to filter logs within the application.
Inside db-JAPI this is ignored.
Example :
Refer to example in constructor TLptsLog
.
public java.lang.String getMessage()
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : Yes. Message can set to null by the application.
Notes : The message could be a warning, debug, plain informational message or error.
Example :
Refer to example in constructor TLptsLog
.
public java.lang.String getSupportingText()
Gets the support text set by the application.
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : Yes. Supporting text can be set to null.
Notes :
Example :
Refer to example in constructor TLptsLog
.
public java.sql.Timestamp getTimestamp()
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : No.
Notes : TimeStamp is set by the constructor.
Example :
Refer to example in constructor TLptsLog
.
public TLptsLogger.LOG_TYPE getType()
Gets the type of the Log.
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : Yes.
Notes : Type can be Error, Message, Debug, Warning, Reset.
Example :
Refer to example in constructor TLptsLog
.
TLptsLogger
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |