Package edu.wpi.first.util.datalog
Class DataLogBackgroundWriter
java.lang.Object
edu.wpi.first.util.datalog.DataLog
edu.wpi.first.util.datalog.DataLogBackgroundWriter
- All Implemented Interfaces:
AutoCloseable
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.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstruct a new Data Log.Construct a new Data Log.DataLogBackgroundWriter
(String dir, String filename) Construct a new Data Log.DataLogBackgroundWriter
(String dir, String filename, double period) Construct a new Data Log.DataLogBackgroundWriter
(String dir, String filename, double period, String extraHeader) Construct a new Data Log. -
Method Summary
Modifier and TypeMethodDescriptionvoid
resume()
Resumes appending of data records to the log.void
setFilename
(String filename) Change log filename.Methods inherited from class edu.wpi.first.util.datalog.DataLog
addSchema, addSchema, addSchema, addSchema, addSchema, addSchema, addSchema, addSchema, appendBoolean, appendBooleanArray, appendDouble, appendDoubleArray, appendFloat, appendFloatArray, appendInteger, appendIntegerArray, appendRaw, appendRaw, appendRaw, appendRaw, appendString, appendStringArray, close, finish, finish, flush, getImpl, hasSchema, pause, setMetadata, setMetadata, start, start, start, stop
-
Constructor Details
-
DataLogBackgroundWriter
Construct a new Data Log. The log will be initially created with a temporary filename.- Parameters:
dir
- directory to store the logfilename
- 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 tradeoffextraHeader
- extra header data
-
DataLogBackgroundWriter
Construct a new Data Log. The log will be initially created with a temporary filename.- Parameters:
dir
- directory to store the logfilename
- 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
Construct a new Data Log. The log will be initially created with a temporary filename.- Parameters:
dir
- directory to store the logfilename
- 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
public DataLogBackgroundWriter()Construct a new Data Log. The log will be initially created with a temporary filename.
-
-
Method Details
-
setFilename
Change log filename.- Parameters:
filename
- filename
-
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.
-