]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: da: fix log-level comparison to emove annoying warning
authorWilly Tarreau <w@1wt.eu>
Mon, 1 Jun 2015 13:25:46 +0000 (15:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Jun 2015 11:42:12 +0000 (13:42 +0200)
When haproxy is run on the foreground with DeviceAtlas enabled, one
line of warning is seen for every test because the comparison is always
true even when loglevel is zero :

willy@wtap:haproxy$ ./haproxy  -db -f test-da.cfg
[WARNING] 151/150831 (25506) : deviceatlas : final memory image 7148029 bytes.
Deviceatlas module loaded.
[WARNING] 151/150832 (25506) : deviceatlas : .
[WARNING] 151/150833 (25506) : deviceatlas : .
[WARNING] 151/150833 (25506) : deviceatlas : .
^C

Don't emit a warning when loglevel is null.

src/da.c

index 6560853f35e078d256344436c81b6b376506b2e0..0f3a86187c19aa581f36778edc67641c79c99fa3 100644 (file)
--- a/src/da.c
+++ b/src/da.c
@@ -70,7 +70,7 @@ static da_status_t da_haproxy_seek(void *ctx, off_t off)
 static void da_haproxy_log(da_severity_t severity, da_status_t status,
        const char *fmt, va_list args)
 {
-       if (severity <= global.deviceatlas.loglevel) {
+       if (global.deviceatlas.loglevel && severity <= global.deviceatlas.loglevel) {
                char logbuf[256];
                vsnprintf(logbuf, sizeof(logbuf), fmt, args);
                Warning("deviceatlas : %s.\n", logbuf);