remove dead codepath, we dont need gz logs
This commit is contained in:
36
src/log.c
36
src/log.c
@@ -6,12 +6,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef LOG_FILE_LOCATION
|
||||
#include <zlib.h>
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user