mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-22 06:27:51 +00:00
Respect LOG_LEVEL_SILENT
This commit is contained in:
parent
8fca6b5c5e
commit
0bf366f789
2
log.c
2
log.c
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user