net.i2p.util
Class LogWriterBase

java.lang.Object
  extended by net.i2p.util.LogWriterBase
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
LogWriter

abstract class LogWriterBase
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 LogWriter so Android may extend

Field Summary
protected  LogManager _manager
           
protected  boolean _write
           
(package private) static long FLUSH_INTERVAL
           
 
Constructor Summary
LogWriterBase(LogManager manager)
           
 
Method Summary
protected abstract  void closeWriter()
           
abstract  String currentFile()
           
 void flushRecords()
           
 void flushRecords(boolean shouldWait)
           
protected abstract  void flushWriter()
           
 void run()
           
 void setFlushInterval(long interval)
           
 void stopWriting()
           
protected abstract  void writeRecord(int priority, String line)
          Write a single String verbatim to the writer.
protected abstract  void writeRecord(LogRecord rec, String formatted)
          Write the provided LogRecord to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLUSH_INTERVAL

static final long FLUSH_INTERVAL
See Also:
Constant Field Values

_manager

protected final LogManager _manager

_write

protected volatile boolean _write
Constructor Detail

LogWriterBase

public LogWriterBase(LogManager manager)
Method Detail

currentFile

public abstract String currentFile()

writeRecord

protected abstract void writeRecord(LogRecord rec,
                                    String formatted)
Write the provided LogRecord to the writer.

Parameters:
rec - the LogRecord to write.
formatted - a String pre-formatted from rec, may be ignored.

writeRecord

protected abstract void writeRecord(int priority,
                                    String line)
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()
Specified by:
run in interface Runnable

flushRecords

public void flushRecords()

flushRecords

public void flushRecords(boolean shouldWait)