summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2010-03-23 14:22:27 +0000
committerKevin P. Fleming <kpfleming@digium.com>2010-03-23 14:22:27 +0000
commitae6008ef3acdb582aca60357f7a7870aabba78a1 (patch)
tree97e4ea6000f94d030759102e139a2646e75100f6 /include
parentf9e4d024c91387de1e189ed92675bb2193d9afb6 (diff)
Change per-file debug and verbose levels to be per-module, the way
users expect them to work. 'core set debug' and 'core set verbose' can optionally change the level for a specific filename; however, this is actually for a specific source file name, not the module that source file is included in. With examples like chan_sip, chan_iax2, chan_misdn and others consisting of multiple source files, this will not lead to the behavior that users expect. If they want to set the debug level for chan_sip, they want it set for all of chan_sip, and not to have to also set it for reqresp_parser and other files that comprise the chan_sip module. This patch changes this functionality to be module-name based instead of file-name based. To make this work, some Makefile modifications were required to ensure that the AST_MODULE definition is present in each object file produced for each module as well. Review: https://reviewboard.asterisk.org/r/574/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/logger.h14
-rw-r--r--include/asterisk/options.h16
2 files changed, 15 insertions, 15 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 75d07d6fe..c829843ee 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -181,18 +181,18 @@ void ast_console_toggle_loglevel(int fd, int level, int state);
#define NUMLOGLEVELS 6
/*!
- * \brief Get the debug level for a file
+ * \brief Get the debug level for a module
* \param file the filename
* \return the debug level
*/
-unsigned int ast_debug_get_by_file(const char *file);
+unsigned int ast_debug_get_by_module(const char *module);
/*!
- * \brief Get the debug level for a file
+ * \brief Get the verbose level for a module
* \param file the filename
- * \return the debug level
+ * \return the verbose level
*/
-unsigned int ast_verbose_get_by_file(const char *file);
+unsigned int ast_verbose_get_by_module(const char *module);
/*!
* \brief Register a new logger level
@@ -231,11 +231,11 @@ void ast_logger_unregister_level(const char *name);
* to get logged
*/
#define ast_debug(level, ...) do { \
- if (option_debug >= (level) || (ast_opt_dbg_file && ast_debug_get_by_file(__FILE__) >= (level)) ) \
+ if (option_debug >= (level) || (ast_opt_dbg_module && ast_debug_get_by_module(AST_MODULE) >= (level)) ) \
ast_log(AST_LOG_DEBUG, __VA_ARGS__); \
} while (0)
-#define VERBOSITY_ATLEAST(level) (option_verbose >= (level) || (ast_opt_verb_file && ast_verbose_get_by_file(__FILE__) >= (level)))
+#define VERBOSITY_ATLEAST(level) (option_verbose >= (level) || (ast_opt_verb_module && ast_verbose_get_by_module(AST_MODULE) >= (level)))
#define ast_verb(level, ...) do { \
if (VERBOSITY_ATLEAST((level)) ) { \
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index d3305be66..c76e8332d 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -78,10 +78,10 @@ enum ast_option_flags {
AST_OPT_FLAG_ALWAYS_FORK = (1 << 21),
/*! Disable log/verbose output to remote consoles */
AST_OPT_FLAG_MUTE = (1 << 22),
- /*! There is a per-file debug setting */
- AST_OPT_FLAG_DEBUG_FILE = (1 << 23),
- /*! There is a per-file verbose setting */
- AST_OPT_FLAG_VERBOSE_FILE = (1 << 24),
+ /*! There is a per-module debug setting */
+ AST_OPT_FLAG_DEBUG_MODULE = (1 << 23),
+ /*! There is a per-module verbose setting */
+ AST_OPT_FLAG_VERBOSE_MODULE = (1 << 24),
/*! Terminal colors should be adjusted for a light-colored background */
AST_OPT_FLAG_LIGHT_BACKGROUND = (1 << 25),
/*! Count Initiated seconds in CDR's */
@@ -119,10 +119,10 @@ enum ast_option_flags {
#define ast_opt_internal_timing ast_test_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING)
#define ast_opt_always_fork ast_test_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
#define ast_opt_mute ast_test_flag(&ast_options, AST_OPT_FLAG_MUTE)
-#define ast_opt_dbg_file ast_test_flag(&ast_options, AST_OPT_FLAG_DEBUG_FILE)
-#define ast_opt_verb_file ast_test_flag(&ast_options, AST_OPT_FLAG_VERBOSE_FILE)
-#define ast_opt_light_background ast_test_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND)
-#define ast_opt_force_black_background ast_test_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
+#define ast_opt_dbg_module ast_test_flag(&ast_options, AST_OPT_FLAG_DEBUG_MODULE)
+#define ast_opt_verb_module ast_test_flag(&ast_options, AST_OPT_FLAG_VERBOSE_MODULE)
+#define ast_opt_light_background ast_test_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND)
+#define ast_opt_force_black_background ast_test_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
#define ast_opt_hide_connect ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT)
#define ast_opt_lock_confdir ast_test_flag(&ast_options, AST_OPT_FLAG_LOCK_CONFIG_DIR)