diff --git a/include/thirdparty/logger/logger.h b/include/thirdparty/logger/logger.h index 3c447013..3a6e2f3b 100644 --- a/include/thirdparty/logger/logger.h +++ b/include/thirdparty/logger/logger.h @@ -20,6 +20,22 @@ #include #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) +#define LOG_INFO(thl, fd, msg) \ + thl->log(thl, fd, msg, LOG_LEVELS_INFO, __FILENAME__, __LINE__); +#define LOG_WARN(thl, fd, msg) \ + thl->log(thl, fd, msg, LOG_LEVELS_WARN, __FILENAME__, __LINE__); +#define LOG_ERROR(thl, fd, msg) \ + thl->log(thl, fd, msg, LOG_LEVELS_ERROR, __FILENAME__, __LINE__); +#define LOG_DEBUG(thl, fd, msg) \ + thl->log(thl, fd, msg, LOG_LEVELS_DEBUG, __FILENAME__, __LINE__); +#define LOGF_INFO(thl, fd, msg, ...) \ + thl->logf(thl, fd, LOG_LEVELS_INFO, __FILENAME__, __LINE__, msg, __VA_ARGS__); +#define LOGF_WARN(thl, fd, msg, ...) \ + thl->logf(thl, fd, LOG_LEVELS_WARN, __FILENAME__, __LINE__, msg, __VA_ARGS__); +#define LOGF_ERROR(thl, fd, msg, ...) \ + thl->logf(thl, fd, LOG_LEVELS_ERROR, __FILENAME__, __LINE__, msg, __VA_ARGS__); +#define LOGF_DEBUG(thl, fd, msg, ...) \ + thl->logf(thl, fd, LOG_LEVELS_DEBUG, __FILENAME__, __LINE__, msg, __VA_ARGS__); /*! @struct base struct used by the thread_logger */ diff --git a/thirdparty/logger/logger.c b/thirdparty/logger/logger.c index 022fd997..2fa3ede1 100644 --- a/thirdparty/logger/logger.c +++ b/thirdparty/logger/logger.c @@ -248,7 +248,6 @@ void clear_file_logger(file_logger *fhl) { char *get_time_string() { char date[75]; strftime(date, sizeof date, "%b %d %r", localtime(&(time_t){time(NULL)})); - // 4 for [ ] and 1 for \0 char *msg = calloc(1, sizeof(date) + 1); if (msg == NULL) { printf("failed to calloc get_time_string\n"); @@ -256,6 +255,5 @@ char *get_time_string() { } strcat(msg, ""); strcat(msg, date); - // strcat(msg, "] "); return msg; } \ No newline at end of file