LogUtilities 1.5.1
A small compiled library for C logging and configuration utility functions.
Loading...
Searching...
No Matches
Reader functions

Functions for reading from log or config files. More...

Functions

FILE * openLogForReading (const char *subject, uint16_t YYYY, uint8_t MM, uint8_t DD, const char *tag, uint16_t index, HeaderData *headerData, Config *config, const char *configFile)
 Opens a log file for reading.
 
int readConfig (Config *config, const char *configFileIn)
 Read the configuration from the config.yaml file.
 
int readFileHeader (FILE *logFile, HeaderData *headerData)
 Reads the header data from the log file.
 

Detailed Description

Functions for reading from log or config files.

Function Documentation

◆ openLogForReading()

FILE * openLogForReading ( const char * subject,
uint16_t YYYY,
uint8_t MM,
uint8_t DD,
const char * tag,
uint16_t index,
HeaderData * headerData,
Config * config,
const char * configFile )

Opens a log file for reading.

This function constructs the full path to the log file based on the provided parameters, opens the file for reading, and reads the header information from the file.

Parameters
subjectThe subject of the log file.
YYYYYear.
MMMonth.
DDDay.
tagThe tag of the log file.
indexThe index of the log file.
headerDataPointer to the header data structure to store the read header information.
configPointer to the logger configuration.
configFileThe file and path of the configuration file.
Returns
A pointer to the opened log file if successful, NULL otherwise.

◆ readConfig()

int readConfig ( Config * config,
const char * configFileIn )

Read the configuration from the config.yaml file.

Parameters
configPointer to the configuration structure.
configFileInString corresponding to name of the config file, or NULL to use default ("config.yaml" in executable folder).
Returns
0 if successful, 1 otherwise.

◆ readFileHeader()

int readFileHeader ( FILE * logFile,
HeaderData * headerData )

Reads the header data from the log file.

Parameters
logFilePointer to the log file.
headerDataPointer to the header data structure.
Returns
0 if header was successfully read, 1 otherwise.