Class DataLogBackgroundWriter

java.lang.Object
edu.wpi.first.util.datalog.DataLog
edu.wpi.first.util.datalog.DataLogBackgroundWriter
All Implemented Interfaces:
AutoCloseable

public final class DataLogBackgroundWriter extends DataLog
A data log background writer that periodically flushes the data log on a background thread. The data log file is created immediately upon construction with a temporary filename. The file may be renamed at any time using the setFilename() function.

The data log is periodically flushed to disk. It can also be explicitly flushed to disk by using the flush() function. This operation is, however, non-blocking.

  • Constructor Details

    • DataLogBackgroundWriter

      public DataLogBackgroundWriter(String dir, String filename, double period, String extraHeader)
      Construct a new Data Log. The log will be initially created with a temporary filename.
      Parameters:
      dir - directory to store the log
      filename - filename to use; if none provided, a random filename is generated of the form "wpilog_{}.wpilog"
      period - time between automatic flushes to disk, in seconds; this is a time/storage tradeoff
      extraHeader - extra header data
    • DataLogBackgroundWriter

      public DataLogBackgroundWriter(String dir, String filename, double period)
      Construct a new Data Log. The log will be initially created with a temporary filename.
      Parameters:
      dir - directory to store the log
      filename - filename to use; if none provided, a random filename is generated of the form "wpilog_{}.wpilog"
      period - time between automatic flushes to disk, in seconds; this is a time/storage tradeoff
    • DataLogBackgroundWriter

      public DataLogBackgroundWriter(String dir, String filename)
      Construct a new Data Log. The log will be initially created with a temporary filename.
      Parameters:
      dir - directory to store the log
      filename - filename to use; if none provided, a random filename is generated of the form "wpilog_{}.wpilog"
    • DataLogBackgroundWriter

      Construct a new Data Log. The log will be initially created with a temporary filename.
      Parameters:
      dir - directory to store the log
    • DataLogBackgroundWriter

      Construct a new Data Log. The log will be initially created with a temporary filename.
  • Method Details

    • setFilename

      public void setFilename(String filename)
      Change log filename.
      Parameters:
      filename - filename
    • resume

      public void resume()
      Resumes appending of data records to the log. If called after stop(), opens a new file (with random name if SetFilename was not called after stop()) and appends Start records and schema data values for all previously started entries and schemas.
      Overrides:
      resume in class DataLog