|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lapetus_ltd.api.common.logger.TLptsLogOutputListener
public class TLptsLogOutputListener
Class Description : This class writes the logs to a text file.
Field Summary | |
---|---|
(package private) java.lang.String |
fileName
|
(package private) boolean |
isMonthFirst
|
Constructor Summary | |
---|---|
TLptsLogOutputListener(java.lang.String path,
boolean isMonthFirst)
This is the constructor for TLptsLogOutputListener. |
Method Summary | |
---|---|
void |
closeOutput()
Closes the log file. |
java.lang.String |
getFileName()
Gets the full path name of the log file. |
boolean |
isReadyForOutput()
Checks to see if the file will accept output. |
void |
newLogGenerated(TLptsLog log)
Implementation of ILptsLogListener.newLogGenerated(TLptsLog) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final java.lang.String fileName
final boolean isMonthFirst
Constructor Detail |
---|
public TLptsLogOutputListener(java.lang.String path, boolean isMonthFirst)
Thread Safe : Yes.
Spawns its own Thread : No.
May Return NULL : No.
Notes :
Example :
//Create a new TLptsLogOutputListener TLptsLogOutputListener logOutputListener = new TLptsLogOutputListener(TLptsFileUtil.getUserHomeLapetusDirectory(),false); ... logOutputListener.closeOutput();
path
- the full path of the file to be saved.isMonthFirst
- If true the month is shown first in the date. Otherwise the day is first.Method Detail |
---|
public void closeOutput()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : No
Notes : No more logs can be written after closing.
Example :
//Create a new TLptsLogOutputListener TLptsLogOutputListener logOutputListener = new TLptsLogOutputListener(TLptsFileUtil.getUserHomeLapetusDirectory(),false); ... logOutputListener.closeOutput();
public java.lang.String getFileName()
Gets the full path name of the log file.
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : Yes
Notes :
Example :
//Create a new TLptsLogOutputListener and set as path the default path of the application TLptsLogOutputListener logOutputListener = new TLptsLogOutputListener(TLptsFileUtil.getUserHomeLapetusDirectory(),false); ... System.out.println("The log file name is " + logOutputListener.getFileName); RESULT: The result will show the user home lapetus directory with a unique filename, which is timestamped.
public boolean isReadyForOutput()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : No
Notes :
Example :
if (isReadyForOutput()) System.out.println("The log file listener is ready for logs to be written to it.");
public void newLogGenerated(TLptsLog log)
ILptsLogListener.newLogGenerated(TLptsLog)
.
newLogGenerated
in interface ILptsLogListener
log
- is the new TLptsLog that occurs from the caught exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |