[wpiutil] Split DataLog background writer into different class (#6590)

DataLog is now a base class, with DataLogBackgroundWriter being the
background thread version and DataLogWriter being a non-threaded version.

Also split the C header into a separate file to make it more wpiformat friendly.
This commit is contained in:
Peter Johnson
2024-05-12 14:09:43 -07:00
committed by GitHub
parent 305a0657e2
commit 178fe99f12
20 changed files with 1588 additions and 1089 deletions

View File

@@ -7,11 +7,13 @@
#include <algorithm>
#include <ctime>
#include <random>
#include <string>
#include <string_view>
#include <fmt/chrono.h>
#include <fmt/format.h>
#include <networktables/NetworkTableInstance.h>
#include <wpi/DataLog.h>
#include <wpi/DataLogBackgroundWriter.h>
#include <wpi/SafeThread.h>
#include <wpi/StringExtras.h>
#include <wpi/fs.h>
@@ -193,7 +195,7 @@ struct Thread final : public wpi::SafeThread {
std::string m_logDir;
bool m_filenameOverride;
wpi::log::DataLog m_log;
wpi::log::DataLogBackgroundWriter m_log;
bool m_ntLoggerEnabled = false;
NT_DataLogger m_ntEntryLogger = 0;
NT_ConnectionDataLogger m_ntConnLogger = 0;

View File

@@ -236,16 +236,17 @@ WPI_DataLog_AppendIntegerArray
WPI_DataLog_AppendRaw
WPI_DataLog_AppendString
WPI_DataLog_AppendStringArray
WPI_DataLog_Create
WPI_DataLog_Create_Func
WPI_DataLog_CreateBackgroundWriter
WPI_DataLog_CreateBackgroundWriter_Func
WPI_DataLog_CreateWriter
WPI_DataLog_Finish
WPI_DataLog_SetMetadata
WPI_DataLog_Start
WPI_DataLog_Flush
WPI_DataLog_Pause
WPI_DataLog_Release
WPI_DataLog_Resume
WPI_DataLog_SetFilename
WPI_DataLog_SetMetadata
WPI_DataLog_Start
WPI_DataLog_SetBackgroundWriterFilename
WPI_DataLog_Stop
WPI_DestroyEvent
WPI_DestroySemaphore