Functions for logging/registering data over time to a text file or terminal.
More...
#include <stddef.h>
Go to the source code of this file.
|
#define | LOG_FILE_PATH_MAX_LENGTH 256 |
| Maximum length of log file (inside data structure) absolute path string.
|
|
#define | DATA_LOG_MAX_PRECISION 15 |
| Maximum decimal precision for numerical data in a log.
|
|
#define | DEBUG_PRINT(formatString, ...) |
|
|
typedef struct _LogData | LogData |
| Single log internal data structure.
|
|
typedef LogData * | Log |
| Opaque reference to log internal data structure.
|
|
Functions for logging/registering data over time to a text file or terminal.
◆ Log_End()
Deallocate and destroys given data structure.
- Parameters
-
[in] | log | reference to log profile |
◆ Log_EnterNewLine()
void Log_EnterNewLine |
( |
Log |
log, |
|
|
double |
timeStamp |
|
) |
| |
Enter new log line indexed in time.
- Parameters
-
[in] | log | reference to log profile |
[in] | timeStamp | provided time index/stamp for new log line |
◆ Log_Init()
Log Log_Init |
( |
const char * |
logPath, |
|
|
size_t |
dataPrecision |
|
) |
| |
Initialize data logging to terminal or a specific text file.
- Parameters
-
[in] | logPath | path (from base one) to log file or empty string for terminal logging |
[in] | dataPrecision | decimal precision for numerical data in this log |
- Returns
- reference/pointer to created log profile structure (NULL on errors)
◆ Log_PrintString()
void Log_PrintString |
( |
Log |
log, |
|
|
const char * |
formatString, |
|
|
|
... |
|
) |
| |
Log custom string.
- Parameters
-
[in] | log | reference to log profile |
[in] | formatString | format string (like in printf) to list of values |
[in] | ... | variable list of values/arguments to be formatted (like in printf) |
◆ Log_RegisterList()
void Log_RegisterList |
( |
Log |
log, |
|
|
size_t |
valuesNumber, |
|
|
double * |
valuesList |
|
) |
| |
Log a numerical values in a array format.
- Parameters
-
[in] | log | reference to log profile |
[in] | valuesNumber | number of values being logged |
[in] | ... | array/pointer of numerical values to be logged |
◆ Log_RegisterValues()
void Log_RegisterValues |
( |
Log |
log, |
|
|
size_t |
valuesNumber, |
|
|
|
... |
|
) |
| |
Log a numerical values in a variable arguments list format.
- Parameters
-
[in] | log | reference to log profile |
[in] | valuesNumber | number of values being logged |
[in] | ... | variable list of numerical values to be logged |
◆ Log_SetBaseName()
void Log_SetBaseName |
( |
const char * |
baseName | ) |
|
Define a common base (folder) name and time stamp for log files.
- Parameters
-
[in] | baseName | name of the folder (inside root path) where new logs will be saved, with current time stamp |
◆ Log_SetDirectory()
void Log_SetDirectory |
( |
const char * |
directoryPath | ) |
|
Overwrite default root file path where logs will be saved.
- Parameters
-
[in] | directoryPath | path (absolute or relative) to desired root directory |