Implement logger functionality and signal handling: add Logger structure with mutex, logging functions, and handle SIGINT in utils.

This commit is contained in:
2025-05-18 19:02:17 +02:00
parent 12749c4552
commit d83f2df60f
7 changed files with 134 additions and 11 deletions
+21
View File
@@ -0,0 +1,21 @@
#ifndef __LOGGER_H__
#define __LOGGER_H__
#include "main.h"
#include "rfid_handler.h"
#include "utils.h"
typedef struct
{
pthread_mutex_t lock;
FILE *f_log;
} Logger;
Logger *initLogger(const char *_filename);
int logErrorEvent(Logger *_logger, const char *_message);
int logWarningEvent(Logger *_logger, const char *_message);
int logHardwareEvent(Logger *_logger, const char *_event_origin, const char *_message);
int logInfoEvent(Logger *_logger, const char *_message);
int endLogger(Logger *_logger);
#endif