Package net.i2p.util
Class LogWriter
java.lang.Object
net.i2p.util.LogWriter
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
FileLogWriter
abstract class LogWriter extends Object implements Runnable
Log writer thread that pulls log records from the LogManager and writes them to
the log. This also periodically instructs the LogManager to reread its config
file.
- Since:
- 0.9.19 pulled from FileLogWriter so Android may extend; renamed from LogWriterBase in 0.9.26
-
Field Summary
Fields Modifier and Type Field Description protected LogManager_managerprotected boolean_write(package private) static longFLUSH_INTERVAL -
Constructor Summary
Constructors Constructor Description LogWriter(LogManager manager) -
Method Summary
Modifier and Type Method Description protected abstract voidcloseWriter()abstract StringcurrentFile()File may not exist or have old logs in it if not opened yetvoidflushRecords()voidflushRecords(boolean shouldWait)protected abstract voidflushWriter()voidrun()voidsetFlushInterval(long interval)voidstopWriting()protected abstract voidwriteRecord(int priority, String line)Write a single String verbatim to the writer.protected abstract voidwriteRecord(LogRecord rec, String formatted)Write the provided LogRecord to the writer.
-
Field Details
-
FLUSH_INTERVAL
static final long FLUSH_INTERVAL- See Also:
- Constant Field Values
-
_manager
-
_write
protected volatile boolean _write
-
-
Constructor Details
-
Method Details
-
currentFile
File may not exist or have old logs in it if not opened yet- Returns:
- non-null
-
writeRecord
Write the provided LogRecord to the writer.- Parameters:
rec- the LogRecord to write.formatted- a String pre-formatted from rec, may be ignored.
-
writeRecord
Write a single String verbatim to the writer.- Parameters:
priority- the level to log the line at.line- the String to write.
-
flushWriter
protected abstract void flushWriter() -
closeWriter
protected abstract void closeWriter() -
stopWriting
public void stopWriting() -
setFlushInterval
public void setFlushInterval(long interval)- Parameters:
interval- ms- Since:
- 0.9.18
-
run
public void run() -
flushRecords
public void flushRecords() -
flushRecords
public void flushRecords(boolean shouldWait)
-