mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Show log level
This commit is contained in:
parent
dca08d32bd
commit
6316609a5f
@ -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++] = ' ';
|
||||
|
Loading…
Reference in New Issue
Block a user