added documentation to sys/log.h

This commit is contained in:
Sven Vogel 2024-04-12 17:34:38 +02:00
parent 667f985d30
commit 949bbb185a
1 changed files with 37 additions and 0 deletions

View File

@ -52,6 +52,16 @@ will not print.
__logf(level, __FILE_NAME__, __LINE__, __func__, format, ##__VA_ARGS__); \ __logf(level, __FILE_NAME__, __LINE__, __func__, format, ##__VA_ARGS__); \
} while(0) } while(0)
/**
* @brief Log a message into all registered streams
*
* @param level of the message
* @param file origin of the message cause
* @param line line in which log call was made
* @param func function the log call was done in
* @param format the format to print following args in
* @param ...
*/
void __logf( void __logf(
const char* restrict level, const char* restrict level,
const char* restrict file, const char* restrict file,
@ -60,6 +70,15 @@ void __logf(
const char* restrict format, const char* restrict format,
...); ...);
/**
* @brief Log a panic message to stderr and perform gracefull crash with exit() denoting a failure
*
* @param file origin of the message cause
* @param line line in which log call was made
* @param func function the log call was done in
* @param format the format to print following args in
* @param ...
*/
void __panicf( void __panicf(
const char* restrict file, const char* restrict file,
const unsigned long line, const unsigned long line,
@ -67,6 +86,15 @@ void __panicf(
const char* restrict format, const char* restrict format,
...); ...);
/**
* @brief Log a critical message to stderr and perform ungracefull crash with abort()
*
* @param file origin of the message cause
* @param line line in which log call was made
* @param func function the log call was done in
* @param format the format to print following args in
* @param ...
*/
void __fatalf( void __fatalf(
const char* restrict file, const char* restrict file,
const unsigned long line, const unsigned long line,
@ -74,8 +102,17 @@ void __fatalf(
const char* restrict format, const char* restrict format,
...); ...);
/**
* @brief Initialize the logger by registering stderr as stream
*
*/
void log_init(void); void log_init(void);
/**
* @brief Register a stream as output source. Must be freed manually at exit if necessary
*
* @param stream
*/
void log_register_stream(FILE* restrict stream); void log_register_stream(FILE* restrict stream);
#endif /* _SYS_ERR_H_ */ #endif /* _SYS_ERR_H_ */