tsLogger
A C++17 data logger for timeseries and snapshot data
|
The core class of the library is the tsLogger class. Multiple simultaneous class objects are supported. More...
#include <include/tsLogger.h>
Public Member Functions | |
tsLogger () | |
Default constructor of the tsLogger class. Uses default values to initialize all object properties. | |
tsLogger (tsLogFileType logFileType) | |
An overloaded 1-parameter constructor of the tsLogger class. Allows the user to set the logfile type. | |
tsLogger (const char *logFileName) | |
An overloaded 1-parameter constructor of the tsLogger class. Allows the user to set the logfile name. | |
tsLogger (const char *logFileName, tsLogFileType logFileType) | |
An overloaded 2-parameter constructor of the tsLogger class. Allows the user to set the file type and file name. | |
tsLogger (const char *logFileName, tsLogFileType logFileType, size_t logBufferMaxSize) | |
An overloaded 3-parameter constructor of the tsLogger class. Allows the user to select file type, file name and internal log buffer size. | |
void | getFilePath (char *pathDestination, size_t pathDestinationLength) |
Allows the user to read the file path of the log file. | |
size_t | getNumDataPoints () |
Returns the total number of data points being tracked for logging by the tsLogger class object. | |
template<typename T > | |
unsigned | trackDataPoint (T *dataPointer, const std::string &dataName) |
Template member function that appends the data point to the list of tracked data. | |
void | appendToPreamble (std::string appendString) |
Appends a line of text to the preamble block of the log file. Replaces new line characters with spaces. | |
void | addPreamble () |
Adds the preamble to the log file-can only be added once and only be called before the addDataHeader function. | |
void | addDataHeader () |
Add the data header (consisting of datapoint names separated by commas) to the header file. Do not call trackDataPoint after this function call. | |
void | startLogger () |
Starts the logger and locks out the ability to add preambles, headers and new data points. | |
void | logData () |
Logs the data points being tracked as a line in the log file. | |
~tsLogger () | |
The core class of the library is the tsLogger class. Multiple simultaneous class objects are supported.
Definition at line 50 of file tsLogger.h.
tsLogger::tsLogger | ( | ) |
Default constructor of the tsLogger class. Uses default values to initialize all object properties.
Definition at line 41 of file tsLogger.cpp.
tsLogger::tsLogger | ( | tsLogFileType | logFileType | ) |
An overloaded 1-parameter constructor of the tsLogger class. Allows the user to set the logfile type.
logFileType | The file type of the logfile per the tsLogFileType enum. |
Definition at line 62 of file tsLogger.cpp.
tsLogger::tsLogger | ( | const char * | logFileName | ) |
An overloaded 1-parameter constructor of the tsLogger class. Allows the user to set the logfile name.
logFileName | The file name of the logfile. You can optionally provide the full file path if you want the file to reside in a particular location. |
Definition at line 83 of file tsLogger.cpp.
tsLogger::tsLogger | ( | const char * | logFileName, |
tsLogFileType | logFileType | ||
) |
An overloaded 2-parameter constructor of the tsLogger class. Allows the user to set the file type and file name.
logFileName | The file name of the logfile. You can optionally provide the full file path if you want the file to reside in a particular location. |
logFileType | The file type of the logfile per the tsLogFileType enum. |
Definition at line 93 of file tsLogger.cpp.
tsLogger::tsLogger | ( | const char * | logFileName, |
tsLogFileType | logFileType, | ||
size_t | logBufferMaxSize | ||
) |
An overloaded 3-parameter constructor of the tsLogger class. Allows the user to select file type, file name and internal log buffer size.
logFileName | The file name of the logfile. You can optionally provide the full file path if you want the file to reside in a particular location. |
logFileType | The file type of the logfile per the tsLogFileType enum. |
logBufferMaxSize | The buffer size of the internal log buffer. When the buffer is full, the data is dumped to file. |
Definition at line 103 of file tsLogger.cpp.
tsLogger::~tsLogger | ( | ) |
Definition at line 236 of file tsLogger.cpp.
void tsLogger::addDataHeader | ( | ) |
Add the data header (consisting of datapoint names separated by commas) to the header file. Do not call trackDataPoint after this function call.
Definition at line 142 of file tsLogger.cpp.
void tsLogger::addPreamble | ( | ) |
Adds the preamble to the log file-can only be added once and only be called before the addDataHeader function.
Definition at line 131 of file tsLogger.cpp.
void tsLogger::appendToPreamble | ( | std::string | appendString | ) |
Appends a line of text to the preamble block of the log file. Replaces new line characters with spaces.
appendString | String to append. |
Definition at line 123 of file tsLogger.cpp.
void tsLogger::getFilePath | ( | char * | pathDestination, |
size_t | pathDestinationLength | ||
) |
Allows the user to read the file path of the log file.
pathDestination | The pointer to the character array to which the user wants the file path to be written. |
pathDestinationLength | The maximum length of data allowed to be written to the character array. |
Definition at line 113 of file tsLogger.cpp.
size_t tsLogger::getNumDataPoints | ( | ) |
Returns the total number of data points being tracked for logging by the tsLogger class object.
Definition at line 118 of file tsLogger.cpp.
void tsLogger::logData | ( | ) |
Logs the data points being tracked as a line in the log file.
Definition at line 173 of file tsLogger.cpp.
void tsLogger::startLogger | ( | ) |
Starts the logger and locks out the ability to add preambles, headers and new data points.
Definition at line 166 of file tsLogger.cpp.
|
inline |
Template member function that appends the data point to the list of tracked data.
T | Template data type of the data point that needs to be tracked. Support data types are governed by smartDataPtr. |
dataPointer | Pointer/reference to the data point that needs to be tracked. |
dataName | Name of the data point that needs to be tracked. This name is used to build the header line of the log file. |
Definition at line 143 of file tsLogger.h.