mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-15 10:29:47 +00:00
Show log level
This commit is contained in:
1 parent
dca08d32bd
commit
6316609a5f
2 files changed
+6
-8
No files matched your search
+3
-4
@@ -1832,11 +1832,10 @@ bool mg_log_prefix(int level, const char *file, int line, const char *fname) {
|
||||
char timebuf[21], buf[50] = "";
|
||||
time_t t = time(NULL);
|
||||
struct tm tmp, *tm = gmtime_r(&t, &tmp);
|
||||
int n, tag;
|
||||
(void)tmp;
|
||||
int n;
|
||||
(void) tmp;
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm);
|
||||
tag = level == LL_ERROR ? 'E' : level == LL_INFO ? 'I' : ' ';
|
||||
n = snprintf(buf, sizeof(buf), "%s %c %s:%d:%s", timebuf, tag, p, line,
|
||||
n = snprintf(buf, sizeof(buf), "%s %d %s:%d:%s", timebuf, level, p, line,
|
||||
fname);
|
||||
if (n < 0 || n > (int) sizeof(buf) - 2) n = sizeof(buf) - 2;
|
||||
while (n < (int) sizeof(buf) - 1) buf[n++] = ' ';
|
||||
|
||||
@@ -36,11 +36,10 @@ bool mg_log_prefix(int level, const char *file, int line, const char *fname) {
|
||||
char timebuf[21], buf[50] = "";
|
||||
time_t t = time(NULL);
|
||||
struct tm tmp, *tm = gmtime_r(&t, &tmp);
|
||||
int n, tag;
|
||||
(void)tmp;
|
||||
int n;
|
||||
(void) tmp;
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm);
|
||||
tag = level == LL_ERROR ? 'E' : level == LL_INFO ? 'I' : ' ';
|
||||
n = snprintf(buf, sizeof(buf), "%s %c %s:%d:%s", timebuf, tag, p, line,
|
||||
n = snprintf(buf, sizeof(buf), "%s %d %s:%d:%s", timebuf, level, p, line,
|
||||
fname);
|
||||
if (n < 0 || n > (int) sizeof(buf) - 2) n = sizeof(buf) - 2;
|
||||
while (n < (int) sizeof(buf) - 1) buf[n++] = ' ';
|
||||
|
||||
Reference in new issue
Block a user