nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 307 forks source link

Bug in log messages #124

Open inovikovmfg opened 8 years ago

inovikovmfg commented 8 years ago

Hello, I have noticed that before each log message goes some number, i.e. "42". Trying to figure out what it was lead me to slog.c where I found this:

const char c = ".-#"; ... line_sz = snprintf(line, sizeof(line), "[%d] %s %d %s\n", (int)s->log.self, time_buf, c[level], msg);

The chars are being printed as integers with %d, this is why we see their ASCII codes instead of symbols themselves. Another problem here is that you have 5 levels of verbosity, but only 4 symbols for them. That makes WEBDIS_DEBUG be printed as "0" because you get out of the array boundaries.