[Asterisk-code-review] Scope Tracing: Add stubs to allow easier cherry-picking (asterisk[13])

Joshua Colp asteriskteam at digium.com
Wed Jun 3 04:00:43 CDT 2020


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14443 )

Change subject: Scope Tracing:  Add stubs to allow easier cherry-picking
......................................................................

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
---
M include/asterisk/logger.h
1 file changed, 65 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved



diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index e19ba94..ada04ab 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -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 @@
 #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 @@
  */
 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

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14443
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I0390ce5651374d8f3e06d7620050acb22c5440a2
Gerrit-Change-Number: 14443
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200603/6ae99305/attachment.html>


More information about the asterisk-code-review mailing list