From a5e3f2e9a31449a177af51231175afebfe9410c8 Mon Sep 17 00:00:00 2001
From: fujuntang <fujuntang@smartai.com>
Date: 星期六, 20 十一月 2021 12:19:30 +0800
Subject: [PATCH] Fix the resource algorithm issue.
---
include/usgcommon/logger.h | 29 +++--------------------------
1 files changed, 3 insertions(+), 26 deletions(-)
diff --git a/include/usgcommon/logger.h b/include/usgcommon/logger.h
index a735086..ccf17cd 100644
--- a/include/usgcommon/logger.h
+++ b/include/usgcommon/logger.h
@@ -16,32 +16,9 @@
LoggerConfig config;
FILE *logFile;
- void dolog(const char *fmt, va_list ap, int level, int err = 0) {
- char buf[MAXBUF];
+ void dolog(const char *fmt, va_list ap, int level, int err = 0);
- struct timeval tv;
- struct tm *info;
- gettimeofday(&tv, NULL);
- info = localtime(&tv.tv_sec);
- strftime(buf, MAXBUF - 1, "%Y-%d-%m %H:%M:%S", info);
- snprintf(buf + strlen(buf), MAXBUF - strlen(buf) - 1, ",%ld [%s] ", tv.tv_usec, strlevel(level));
- vsnprintf(buf + strlen(buf), MAXBUF - strlen(buf) - 1, fmt, ap);
-
- if (err != 0) {
- snprintf(buf + strlen(buf), MAXBUF - strlen(buf) - 1, ": %s", strerror(err));
- }
- strcat(buf, "\n");
- fflush(stdout); /* in case stdout and stderr are the same */
-
- if(logFile != NULL) {
- fputs(buf, logFile);
- }
- if(config.console) {
- fputs(buf, stdout);
- }
-
- fflush(NULL); /* flushes all stdio output streams */
- }
+
void init();
private:
@@ -64,7 +41,7 @@
void error(const char *fmt, ...);
void error(int err, const char *fmt, ...);
void fatal(const char *fmt, ...);
-
+ void fatal(int err, const char *fmt, ...) ;
static const char * strlevel(int level);
};
--
Gitblit v1.8.0