- Add log_perror() helper (context + strerror(errno)) to the log module - Replace all bare perror() calls with log_perror() so errors are routed through the unified logger (stderr sink + optional --log-file sink) - Convert fprintf(stderr, "Error:/Warning: ...") in client code to log_message(); raw fprintf kept only for progress/stats output
14 lines
320 B
C
14 lines
320 B
C
#ifndef LOG_H
|
|
#define LOG_H
|
|
|
|
#include <stdio.h>
|
|
|
|
typedef enum { LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, LOG_LEVEL_ERROR } LogLevel;
|
|
|
|
void log_message(LogLevel log_level, const char* message, ...);
|
|
void log_perror(const char* context);
|
|
void set_log_level(LogLevel level);
|
|
void log_set_file(FILE* fp);
|
|
|
|
#endif
|