<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6620">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">logger: Bring back ability to turn debug on by source file<br><br>Somewhere along the way we lost the ability to debug individual<br>source files. For modules, this wasn't a big deal but all the<br>source files in ./main are in the one "core" module so debugging<br>individual core capabilities was almost impossible.<br><br>* Added a new function "ast_debug_get_by_file" to logger.h/cli.c<br>which gets the debug level for a specific sourfe file. You can now<br>do a "core set debug 3 bridge_channel.c" for instance, and only turn<br>debugging on for that since source file. This isn't limited to<br>source files in ./main. Any source file works so you could also do<br>"core set debug 3 pjsip_message_filter.c".<br><br>Change-Id: Icc0af41837f3b1679dec7af21fa32cd1f7469f6e<br>---<br>M include/asterisk/logger.h<br>M main/cli.c<br>2 files changed, 29 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/20/6620/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h<br>index 849f986..88b934f 100644<br>--- a/include/asterisk/logger.h<br>+++ b/include/asterisk/logger.h<br>@@ -310,6 +310,16 @@<br> unsigned int ast_debug_get_by_module(const char *module);<br> <br> /*!<br>+ * \brief Get the debug level for a source file<br>+ * \since 13.18.0<br>+ * \since 14.7.0<br>+ * \since 15.1.0<br>+ * \param file the name of source file<br>+ * \return the debug level<br>+ */<br>+unsigned int ast_debug_get_by_file(const char *file);<br>+<br>+/*!<br> * \brief Get the verbose level for a module<br> * \param module the name of module<br> * \return the verbose level<br>@@ -429,7 +439,8 @@<br> <br> #define DEBUG_ATLEAST(level) \<br> (option_debug >= (level) \<br>- || (ast_opt_dbg_module && (int)ast_debug_get_by_module(AST_MODULE) >= (level)))<br>+ || (ast_opt_dbg_module && ((int)ast_debug_get_by_module(AST_MODULE) >= (level) \<br>+ || (int)ast_debug_get_by_file(__FILE__) >= (level))))<br> <br> /*!<br> * \brief Log a DEBUG message<br>diff --git a/main/cli.c b/main/cli.c<br>index ef86e25..f11ef7d 100644<br>--- a/main/cli.c<br>+++ b/main/cli.c<br>@@ -149,6 +149,23 @@<br> return res;<br> }<br> <br>+unsigned int ast_debug_get_by_file(const char *file)<br>+{<br>+ struct module_level *ml;<br>+ unsigned int res = 0;<br>+<br>+ AST_RWLIST_RDLOCK(&debug_modules);<br>+ AST_LIST_TRAVERSE(&debug_modules, ml, entry) {<br>+ if (!strcasecmp(ml->module, file)) {<br>+ res = ml->level;<br>+ break;<br>+ }<br>+ }<br>+ AST_RWLIST_UNLOCK(&debug_modules);<br>+<br>+ return res;<br>+}<br>+<br> unsigned int ast_verbose_get_by_module(const char *module)<br> {<br> return 0;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6620">change 6620</a>. To unsubscribe, 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/6620"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Icc0af41837f3b1679dec7af21fa32cd1f7469f6e </div>
<div style="display:none"> Gerrit-Change-Number: 6620 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>