]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
logger.h: Fix ast_trace to respect scope_level
authorGeorge Joseph <gjoseph@digium.com>
Thu, 17 Sep 2020 16:40:39 +0000 (10:40 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Tue, 22 Sep 2020 14:54:23 +0000 (09:54 -0500)
ast_trace() was always emitting messages when it's level was set to -1
because it was ignoring scope_level.

Change-Id: I849c8f4f4613899c37f82be0202024e7d117e506

include/asterisk/logger.h

index 72c938d3de83f3531dd5bb48e1d2471cb63438c7..6ab55f76da63668889ec82cd46c971ca2eef5ca8 100644 (file)
@@ -663,7 +663,7 @@ void __attribute__((format (printf, 6, 7))) __ast_trace(const char *file, int li
  */
 #define ast_trace_raw(level, indent_type, ...) \
        ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__); \
-       if (TRACE_ATLEAST(level)) { \
+       if (TRACE_ATLEAST(level < 0 ? __scope_level : level)) { \
                __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, indent_type, 0, " " __VA_ARGS__); \
        }
 
@@ -678,7 +678,7 @@ void __attribute__((format (printf, 6, 7))) __ast_trace(const char *file, int li
  */
 #define ast_trace(level, ...) \
        ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__); \
-       if (TRACE_ATLEAST(level)) { \
+       if (TRACE_ATLEAST(level < 0 ? __scope_level : level)) { \
                __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_SAME, 0, " " __VA_ARGS__); \
        }