Scope Tracing: Add stubs to allow easier cherry-picking

Scope tracing isn't supported in Asterisk 13 due to changes made
to logging between 13 and 16 but since the scope tracing macros
may be present in the 16, 17 and master branches, those macros
are defined here as NOOPs so cherry-picking changes downward
to 13 can still be seamless.

Change-Id: I0390ce5651374d8f3e06d7620050acb22c5440a2
This commit is contained in:
George Joseph
2020-05-21 07:20:28 -06:00
committed by Joshua Colp
parent e7f7c8c9de
commit edf9471e05

View File

@@ -26,6 +26,7 @@
#define _ASTERISK_LOGGER_H
#include "asterisk/options.h" /* need option_debug */
#include "asterisk/inline_api.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -231,6 +232,17 @@ void ast_console_toggle_loglevel(int fd, int level, int state);
#endif
#define AST_LOG_DEBUG __LOG_DEBUG, _A_
#ifdef LOG_TRACE
#undef LOG_TRACE
#endif
#define __LOG_TRACE 1
#define LOG_TRACE __LOG_TRACE, _A_
#ifdef AST_LOG_TRACE
#undef AST_LOG_TRACE
#endif
#define AST_LOG_TRACE __LOG_TRACE, _A_
#ifdef LOG_NOTICE
#undef LOG_NOTICE
#endif
@@ -543,6 +555,59 @@ void ast_logger_set_queue_limit(int queue_limit);
*/
int ast_logger_get_queue_limit(void);
/*!
\page Scope_Trace Scope Trace
Scope tracing is not available in this version of Asterisk.
The declatrations and stubs below are there to facilitate
cherry-picking from branches where it is available.
*/
/*!
* \brief Get the trace level for a module
* \param module the name of module
* \return the trace level
*/
AST_INLINE_API(
unsigned int ast_trace_get_by_module(const char *module),
{
return 0;
}
)
#define TRACE_ATLEAST(level) (0)
/*!
* \brief Controls if and when indenting is applied.
*/
enum ast_trace_indent_type {
/*! Use the existing indent level */
AST_TRACE_INDENT_SAME = 0,
/*! Increment the indent before printing the message */
AST_TRACE_INDENT_INC_BEFORE,
/*! Increment the indent after printing the message */
AST_TRACE_INDENT_INC_AFTER,
/*! Decrement the indent before printing the message */
AST_TRACE_INDENT_DEC_BEFORE,
/*! Decrement the indent after printing the message */
AST_TRACE_INDENT_DEC_AFTER,
/*! Don't use or alter the level */
AST_TRACE_INDENT_NONE,
};
/*
* The "#if 1" keeps the last few lines of scope tracing
* common to all branches.
*/
#if 1
#define ast_trace(__level)
#define ast_trace_raw(__level, __indent_type, __fmt, ...)
#define ast_trace_msg(__level, __indent_type, __fmt, ...)
#define SCOPE_TRACE_MSG(__debug_level, __fmt, ...)
#define SCOPE_TRACE(__level)
#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif