Respect LOG_LEVEL_SILENT

This commit is contained in:
Andrew Bettison 2012-06-15 18:07:42 +09:30
parent 8fca6b5c5e
commit 0bf366f789

2
log.c
View File

@ -37,6 +37,7 @@ void logMessage(int level, const char *file, unsigned int line, const char *func
void vlogMessage(int level, const char *file, unsigned int line, const char *function, const char *fmt, va_list ap) void vlogMessage(int level, const char *file, unsigned int line, const char *function, const char *fmt, va_list ap)
{ {
if (level != LOG_LEVEL_SILENT) {
strbuf b = strbuf_alloca(8192); strbuf b = strbuf_alloca(8192);
strbuf_sprintf(b, "%s:%u:%s() ", file ? trimbuildpath(file) : "NULL", line, function ? function : "NULL"); strbuf_sprintf(b, "%s:%u:%s() ", file ? trimbuildpath(file) : "NULL", line, function ? function : "NULL");
strbuf_vsprintf(b, fmt, ap); strbuf_vsprintf(b, fmt, ap);
@ -61,6 +62,7 @@ void vlogMessage(int level, const char *file, unsigned int line, const char *fun
} }
fprintf(stderr, "%s: %s\n", levelstr, strbuf_str(b)); fprintf(stderr, "%s: %s\n", levelstr, strbuf_str(b));
} }
}
const char *trimbuildpath(const char *path) const char *trimbuildpath(const char *path)
{ {