diff --git a/include/log.h b/include/log.h index 3bb332c..48853e6 100644 --- a/include/log.h +++ b/include/log.h @@ -5,9 +5,6 @@ /* comment out to disable all logging */ #define APPLOG_ENABLED -/* comment out to disable file logging */ -/* #define LOG_FILE_LOCATION "linuxSmartie.log.gz" */ - /* ─────────────────────────────────────────────────────────────────────── */ #ifdef APPLOG_ENABLED diff --git a/src/log.c b/src/log.c index d80a672..43994c0 100644 --- a/src/log.c +++ b/src/log.c @@ -6,12 +6,6 @@ #include #include #include -#include - -#ifdef LOG_FILE_LOCATION -#include -static pthread_mutex_t fmtx = PTHREAD_MUTEX_INITIALIZER; -#endif static pthread_mutex_t cmtx = PTHREAD_MUTEX_INITIALIZER; @@ -74,36 +68,6 @@ void log_write(const log_level_t level, const char *func, const char *fmt, ...) pthread_mutex_unlock(&cmtx); va_end(ap); } - -#ifdef LOG_FILE_LOCATION - /* ── file ────────────────────────────────────────────────────────── */ - { - char timebuf[32]; - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - struct tm tm_info; - localtime_r(&ts.tv_sec, &tm_info); - strftime(timebuf, sizeof(timebuf), "%x %H:%M:%S", &tm_info); - - char msgbuf[1024]; - va_list ap; - va_start(ap, fmt); - int offset = snprintf(msgbuf, sizeof(msgbuf), - "%s.%03ld [%s%s%s] ", - timebuf, ts.tv_nsec / 1000000L, - color, funcname, reset); - vsnprintf(msgbuf + offset, sizeof(msgbuf) - offset, fmt, ap); - va_end(ap); - - pthread_mutex_lock(&fmtx); - gzFile file = gzopen(LOG_FILE_LOCATION, "ab"); - if (file) { - gzprintf(file, "%s\n", msgbuf); - gzclose(file); - } - pthread_mutex_unlock(&fmtx); - } -#endif /* LOG_FILE_LOCATION */ } #endif /* APPLOG_ENABLED */