<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17573">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">logger: use __FUNCTION__ instead of __PRETTY_FUNCTION__<br><br>This avoids a few long-name overflows, at the cost of less instructive<br>names in the case of C++ (specifically overloaded functions and class<br>methods). This in turn is offset against the fact that we're logging<br>the filename and line numbers in any case.<br><br>Change-Id: I54101a0bb5f8cb9ef63ec12c5e0d4c8edafff9ed<br>Signed-off-by: Jaco Kroon <jaco@uls.co.za><br>---<br>M include/asterisk/logger.h<br>1 file changed, 15 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h</span><br><span>index 08e90bb..270b5d3 100644</span><br><span>--- a/include/asterisk/logger.h</span><br><span>+++ b/include/asterisk/logger.h</span><br><span>@@ -39,6 +39,8 @@</span><br><span> a; \</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define _A_ __FILE__, __LINE__, __FUNCTION__</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define VERBOSE_PREFIX_1 " "</span><br><span> #define VERBOSE_PREFIX_2 " == "</span><br><span> #define VERBOSE_PREFIX_3 " -- "</span><br><span>@@ -175,8 +177,8 @@</span><br><span> */</span><br><span> void __attribute__((format(printf, 6, 7))) __ast_verbose_callid(const char *file, int line, const char *func, int level, ast_callid callid, const char *fmt, ...);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, __VA_ARGS__)</span><br><span style="color: hsl(0, 100%, 40%);">-#define ast_verbose_callid(callid, ...) __ast_verbose_callid(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, callid, __VA_ARGS__)</span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_verbose(...) __ast_verbose(_A_, -1, __VA_ARGS__)</span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_verbose_callid(callid, ...) __ast_verbose_callid(_A_, -1, callid, __VA_ARGS__)</span><br><span> </span><br><span> void __attribute__((format(printf, 6, 0))) __ast_verbose_ap(const char *file, int line, const char *func, int level, ast_callid callid, const char *fmt, va_list ap);</span><br><span> </span><br><span>@@ -233,8 +235,6 @@</span><br><span> * needed for third-party modules</span><br><span> */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> #ifdef LOG_DEBUG</span><br><span> #undef LOG_DEBUG</span><br><span> #endif</span><br><span>@@ -437,7 +437,7 @@</span><br><span> * \since 1.8</span><br><span> */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define ast_log_dynamic_level(level, ...) ast_log(level, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)</span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_log_dynamic_level(level, ...) ast_log(level, _A_, __VA_ARGS__)</span><br><span> </span><br><span> #define DEBUG_ATLEAST(level) \</span><br><span> (option_debug >= (level) \</span><br><span>@@ -464,14 +464,14 @@</span><br><span> #define ast_verb(level, ...) \</span><br><span> do { \</span><br><span> if (VERBOSITY_ATLEAST(level) ) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_verbose(_A_, level, __VA_ARGS__); \</span><br><span> } \</span><br><span> } while (0)</span><br><span> </span><br><span> #define ast_verb_callid(level, callid, ...) \</span><br><span> do { \</span><br><span> if (VERBOSITY_ATLEAST(level) ) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_verbose_callid(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, callid, __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_verbose_callid(_A_, level, callid, __VA_ARGS__); \</span><br><span> } \</span><br><span> } while (0)</span><br><span> </span><br><span>@@ -678,7 +678,7 @@</span><br><span> #define ast_trace_raw(level, indent_type, ...) \</span><br><span> ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(level < 0 ? __scope_level : level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, indent_type, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, indent_type, 0, " " __VA_ARGS__); \</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -693,7 +693,7 @@</span><br><span> #define ast_trace(level, ...) \</span><br><span> ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(level < 0 ? __scope_level : level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_SAME, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_SAME, 0, " " __VA_ARGS__); \</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -783,7 +783,7 @@</span><br><span> int __scope_task = 0; \</span><br><span> ast_debug(__scope_level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_INC_AFTER, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_INC_AFTER, 0, " " __VA_ARGS__); \</span><br><span> } \</span><br><span> </span><br><span> #define SCOPE_ENTER_TASK(level, indent, ...) \</span><br><span>@@ -791,7 +791,7 @@</span><br><span> int __scope_task = 1; \</span><br><span> ast_debug(__scope_level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_PROVIDED, indent, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_PROVIDED, indent, " " __VA_ARGS__); \</span><br><span> } \</span><br><span> </span><br><span> /*!</span><br><span>@@ -806,7 +806,7 @@</span><br><span> #define SCOPE_EXIT(...) \</span><br><span> ast_debug(__scope_level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(__scope_level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span> if (__scope_task) { \</span><br><span> _ast_trace_set_indent(0); \</span><br><span> } \</span><br><span>@@ -836,7 +836,7 @@</span><br><span> #define SCOPE_EXIT_EXPR(__expr, ...) \</span><br><span> ast_debug(__scope_level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(__scope_level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span> if (__scope_task) { \</span><br><span> _ast_trace_set_indent(0); \</span><br><span> } \</span><br><span>@@ -856,7 +856,7 @@</span><br><span> #define SCOPE_EXIT_RTN(...) \</span><br><span> ast_debug(__scope_level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(__scope_level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span> if (__scope_task) { \</span><br><span> _ast_trace_set_indent(0); \</span><br><span> } \</span><br><span>@@ -877,7 +877,7 @@</span><br><span> #define SCOPE_EXIT_RTN_VALUE(__return_value, ...) \</span><br><span> ast_debug(__scope_level, " " __VA_ARGS__); \</span><br><span> if (TRACE_ATLEAST(__scope_level)) { \</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \</span><br><span> if (__scope_task) { \</span><br><span> _ast_trace_set_indent(0); \</span><br><span> } \</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17573">change 17573</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17573"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: I54101a0bb5f8cb9ef63ec12c5e0d4c8edafff9ed </div>
<div style="display:none"> Gerrit-Change-Number: 17573 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>