add logging code and get it setup

This commit is contained in:
Nayan
2025-05-08 20:54:10 -04:00
parent 6a17569284
commit 6468cc8d55
5 changed files with 103 additions and 8 deletions

21
logging.h Normal file
View File

@@ -0,0 +1,21 @@
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#define LOG_FILE_NAME "./logs/log.txt"
#define LOG_DEBUG 0
#define LOG_INFO 1
#define LOG_WARN 2
#define LOG_ERROR 3
void set_log_level(int level);
void log_message(int level, const char* fmt, ...);
void open_log_file();
void close_log_file();