[Asterisk-code-review] logger: use __FUNCTION__ instead of __PRETTY_FUNCTION__ (asterisk[master])
Jaco Kroon
asteriskteam at digium.com
Thu Oct 28 10:52:50 CDT 2021
Jaco Kroon has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16661 )
Change subject: logger: use __FUNCTION__ instead of __PRETTY_FUNCTION__
......................................................................
logger: use __FUNCTION__ instead of __PRETTY_FUNCTION__
This avoids a few long-name overflows, at the cost of less instructive
names in the case of C++ (specifically overloaded functions and class
methods). This in turn is offset against the fact that we're logging
the filename and line numbers in any case.
Change-Id: I54101a0bb5f8cb9ef63ec12c5e0d4c8edafff9ed
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M include/asterisk/logger.h
1 file changed, 15 insertions(+), 15 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/61/16661/1
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 4234262..2284fe8 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -38,6 +38,8 @@
a; \
}
+#define _A_ __FILE__, __LINE__, __FUNCTION__
+
#define VERBOSE_PREFIX_1 " "
#define VERBOSE_PREFIX_2 " == "
#define VERBOSE_PREFIX_3 " -- "
@@ -174,8 +176,8 @@
*/
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, ...);
-#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, __VA_ARGS__)
-#define ast_verbose_callid(callid, ...) __ast_verbose_callid(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, callid, __VA_ARGS__)
+#define ast_verbose(...) __ast_verbose(_A_, -1, __VA_ARGS__)
+#define ast_verbose_callid(callid, ...) __ast_verbose_callid(_A_, -1, callid, __VA_ARGS__)
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);
@@ -232,8 +234,6 @@
* needed for third-party modules
*/
-#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
-
#ifdef LOG_DEBUG
#undef LOG_DEBUG
#endif
@@ -436,7 +436,7 @@
* \since 1.8
*/
-#define ast_log_dynamic_level(level, ...) ast_log(level, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
+#define ast_log_dynamic_level(level, ...) ast_log(level, _A_, __VA_ARGS__)
#define DEBUG_ATLEAST(level) \
(option_debug >= (level) \
@@ -463,14 +463,14 @@
#define ast_verb(level, ...) \
do { \
if (VERBOSITY_ATLEAST(level) ) { \
- __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, __VA_ARGS__); \
+ __ast_verbose(_A_, level, __VA_ARGS__); \
} \
} while (0)
#define ast_verb_callid(level, callid, ...) \
do { \
if (VERBOSITY_ATLEAST(level) ) { \
- __ast_verbose_callid(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, callid, __VA_ARGS__); \
+ __ast_verbose_callid(_A_, level, callid, __VA_ARGS__); \
} \
} while (0)
@@ -677,7 +677,7 @@
#define ast_trace_raw(level, indent_type, ...) \
ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(level < 0 ? __scope_level : level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, indent_type, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, indent_type, 0, " " __VA_ARGS__); \
}
/*!
@@ -692,7 +692,7 @@
#define ast_trace(level, ...) \
ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(level < 0 ? __scope_level : level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_SAME, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_SAME, 0, " " __VA_ARGS__); \
}
/*!
@@ -782,7 +782,7 @@
int __scope_task = 0; \
ast_debug(__scope_level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_INC_AFTER, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_INC_AFTER, 0, " " __VA_ARGS__); \
} \
#define SCOPE_ENTER_TASK(level, indent, ...) \
@@ -790,7 +790,7 @@
int __scope_task = 1; \
ast_debug(__scope_level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_PROVIDED, indent, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_PROVIDED, indent, " " __VA_ARGS__); \
} \
/*!
@@ -805,7 +805,7 @@
#define SCOPE_EXIT(...) \
ast_debug(__scope_level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(__scope_level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
if (__scope_task) { \
_ast_trace_set_indent(0); \
} \
@@ -834,7 +834,7 @@
#define SCOPE_EXIT_EXPR(__expr, ...) \
ast_debug(__scope_level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(__scope_level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
if (__scope_task) { \
_ast_trace_set_indent(0); \
} \
@@ -854,7 +854,7 @@
#define SCOPE_EXIT_RTN(...) \
ast_debug(__scope_level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(__scope_level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
if (__scope_task) { \
_ast_trace_set_indent(0); \
} \
@@ -875,7 +875,7 @@
#define SCOPE_EXIT_RTN_VALUE(__return_value, ...) \
ast_debug(__scope_level, " " __VA_ARGS__); \
if (TRACE_ATLEAST(__scope_level)) { \
- __ast_trace(__FILE__, __LINE__, __PRETTY_FUNCTION__, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
+ __ast_trace(_A_, AST_TRACE_INDENT_DEC_BEFORE, 0, " " __VA_ARGS__); \
if (__scope_task) { \
_ast_trace_set_indent(0); \
} \
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16661
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I54101a0bb5f8cb9ef63ec12c5e0d4c8edafff9ed
Gerrit-Change-Number: 16661
Gerrit-PatchSet: 1
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211028/2b8b6245/attachment.html>
More information about the asterisk-code-review
mailing list