]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hlua: Display debug messages on stderr only in debug mode
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 2 Oct 2020 16:13:52 +0000 (18:13 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 5 Oct 2020 09:11:36 +0000 (11:11 +0200)
Debug Messages emitted in lua using core.Debug() or core.log() are now only
displayed on stderr if HAProxy is started in debug mode (-d parameter on the
command line). There is no change for other message levels.

This patch should fix the issue #879. It may be backported to all stable
versions.

src/hlua.c

index 390191e05f1fbbb7b01edf8a9db63008eb8b8ba4..e7cac654757592efef1724948b6bc1d20b762ebf 100644 (file)
@@ -945,6 +945,9 @@ static inline void hlua_sendlog(struct proxy *px, int level, const char *msg)
 
        send_log(px, level, "%s\n", trash.area);
        if (!(global.mode & MODE_QUIET) || (global.mode & (MODE_VERBOSE | MODE_STARTING))) {
+               if (level == LOG_DEBUG && !(global.mode & MODE_DEBUG))
+                       return;
+
                get_localtime(date.tv_sec, &tm);
                fprintf(stderr, "[%s] %03d/%02d%02d%02d (%d) : %s\n",
                        log_levels[level], tm.tm_yday, tm.tm_hour, tm.tm_min, tm.tm_sec,