|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jaer.util.TobiLogger
public class TobiLogger
Eases writing log files for any purpose. To use it, construct a new instance, then enable it to open the file and enable the subsequent logging calls to write. Enabling logging automatically opens the file. The logging files are created in the startup directory, e.g. in jAER, in the folder host/java. Each log call prepends the system time automatically as the first field.
Field Summary | |
---|---|
protected java.io.PrintStream |
logStream
|
Constructor Summary | |
---|---|
TobiLogger(java.lang.String filename,
java.lang.String headerLineComment)
Creates a new instance of TobiLogger. |
Method Summary | |
---|---|
boolean |
isAbsoluteTimeEnabled()
|
boolean |
isEnabled()
|
boolean |
isNanotimeEnabled()
|
void |
log(java.lang.String s)
Logs a string to the file (\n is appended), if logging is enabled. |
void |
setAbsoluteTimeEnabled(boolean absoluteTimeEnabled)
If true, then absolute time (since 1970) in ms is first item in line, otherwise, time since file creation is logged. |
void |
setEnabled(boolean logDataEnabled)
Enables or disables logging; default is disabled. |
void |
setNanotimeEnabled(boolean nanotimeEnabled)
Sets whether to use System.nanotime() or the (default) System.currentTimeMillis() |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.PrintStream logStream
Constructor Detail |
---|
public TobiLogger(java.lang.String filename, java.lang.String headerLineComment)
filename
- the filename. Date/Timestamp string us appended to the filename
and ".txt" is appended if it is not already the suffix, e.g. "PencilBalancer-2008-10-12T10-23-58+0200.txt". The file is created in the program startup folder.headerLineComment
- a comment usuually specifying the contents and data fields, a # is prepended automatically.
A second header line is also written automatically with the file creation date, e.g. "# created Sat Oct 11 13:04:34 CEST 2008"Method Detail |
---|
public void log(java.lang.String s)
s
- the stringsetEnabled(boolean)
public boolean isEnabled()
public void setEnabled(boolean logDataEnabled)
logDataEnabled
- true to enable loggingpublic boolean isAbsoluteTimeEnabled()
public void setAbsoluteTimeEnabled(boolean absoluteTimeEnabled)
absoluteTimeEnabled
- default falsepublic boolean isNanotimeEnabled()
public void setNanotimeEnabled(boolean nanotimeEnabled)
nanotimeEnabled
- true to use nanotime
|
jAER project on SourceForge | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |