BUG/MINOR: da: fix log-level comparison to emove annoying warning

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.
This commit is contained in:
Willy Tarreau 2015-06-01 15:25:46 +02:00
parent b5efa0149f
commit 6bd42e7f41

View File

@ -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);