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

Functions for writing to log or config files. More...

Functions

int addFileHeader (FILE *logFile, uint16_t index, HeaderData *headerData, unsigned int *seed)
 Writes header information to the log file.
 
FILE * openLogForWriting (const char *subject, const char *tag, uint16_t index, size_t chunkSize, HeaderData *headerData, Config *config, const char *configFile)
 Opens a log file for writing.
 
FILE * openNewLogForWriting (const char *subject, const char *tag, uint16_t index, size_t chunkSize, HeaderData *headerData, Config *config, unsigned int *seed, const char *configFile)
 Opens a new log file for writing.
 

Detailed Description

Functions for writing to log or config files.

Function Documentation

◆ addFileHeader()

int addFileHeader ( FILE * logFile,
uint16_t index,
HeaderData * headerData,
unsigned int * seed )

Writes header information to the log file.

Parameters
logFilePointer to the log file.
indexThe index of the log file.
headerDataPointer to the header data structure.
seedPointer to random number seed. If NULL, file header generates new seed; otherwise use this seed for random generator.
Returns
0 if header was successfully written, 1 otherwise.

◆ openLogForWriting()

FILE * openLogForWriting ( const char * subject,
const char * tag,
uint16_t index,
size_t chunkSize,
HeaderData * headerData,
Config * config,
const char * configFile )

Opens a log file for writing.

Parameters
subjectThe subject of the log file.
tagThe tag of the log file.
indexThe index of the log file.
chunkSizeThe size of each data chunk.
headerDataPointer to the header data structure.
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.

◆ openNewLogForWriting()

FILE * openNewLogForWriting ( const char * subject,
const char * tag,
uint16_t index,
size_t chunkSize,
HeaderData * headerData,
Config * config,
unsigned int * seed,
const char * configFile )

Opens a new log file for writing.

Parameters
subjectThe subject of the log file.
tagThe tag of the log file.
indexThe index of the log file.
chunkSizeThe size of each data chunk.
headerDataPointer to the header data structure.
configPointer to the logger configuration.
seedPointer to random generator seed. If NULL, file header generates new seed; otherwise use this seed for random generator.
configFileThe file and path of the configuration file.
Returns
A pointer to the opened log file if successful, NULL otherwise.