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 Details

    • FLUSH_INTERVAL

      static final long FLUSH_INTERVAL
      See Also:
    • _manager

      protected final LogManager _manager
    • _write

      protected volatile boolean _write
  • Constructor Details

    • LogWriter

      public LogWriter(LogManager manager)
  • Method Details

    • currentFile

      public abstract String currentFile()
      File may not exist or have old logs in it if not opened yet
      Returns:
      non-null
    • 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)