mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 00:24:05 +00:00
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
This commit is contained in:
@@ -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)) ) { \
|
||||
|
Reference in New Issue
Block a user