webdis
webdis copied to clipboard
Bug in log messages
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.