From 9057aa20b6b822d3c14c241bea9709e6b61d7dbe Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Mon, 12 Dec 2011 19:35:08 +0000 Subject: Backed out core changes from r346391 During testing, it was discovered that there were a number of side effects introduced by r346391 and subsequent check-ins related to it (r346429, r346617, and r346655). This included the /main/stdtime/ test 'hanging', as well as the remote console option failing to receive the appropriate output after a period of time. I only backed out the changes to main/ and utils/, as this was adequate to reverse the behavior experienced. (issue ASTERISK-18974) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347997 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/logger.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'include/asterisk') diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h index a3e436d44..9363caa74 100644 --- a/include/asterisk/logger.h +++ b/include/asterisk/logger.h @@ -68,20 +68,19 @@ int logger_reload(void); void __attribute__((format(printf, 5, 6))) ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...); /*! Send a verbose message (based on verbose level) - * \brief This works like ast_log, but prints verbose messages to the console depending on verbosity level set. - * ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing"); - * This will print the message to the console if the verbose level is set to a level >= 3 - * Note the absence of a comma after the VERBOSE_PREFIX_3. This is important. - * VERBOSE_PREFIX_1 through VERBOSE_PREFIX_4 are defined. - * \version 11 added level parameter + \brief This works like ast_log, but prints verbose messages to the console depending on verbosity level set. + ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing"); + This will print the message to the console if the verbose level is set to a level >= 3 + Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important. + VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined. */ -void __attribute__((format(printf, 5, 6))) __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt, ...); +void __attribute__((format(printf, 4, 5))) __ast_verbose(const char *file, int line, const char *func, const char *fmt, ...); -#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, __VA_ARGS__) +#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__) -void __attribute__((format(printf, 5, 0))) __ast_verbose_ap(const char *file, int line, const char *func, int level, const char *fmt, va_list ap); +void __attribute__((format(printf, 4, 0))) __ast_verbose_ap(const char *file, int line, const char *func, const char *fmt, va_list ap); -#define ast_verbose_ap(fmt, ap) __ast_verbose_ap(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, fmt, ap) +#define ast_verbose_ap(fmt, ap) __ast_verbose_ap(__FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ap) void __attribute__((format(printf, 2, 3))) ast_child_verbose(int level, const char *fmt, ...); @@ -241,7 +240,20 @@ void ast_logger_unregister_level(const char *name); #define VERBOSITY_ATLEAST(level) (option_verbose >= (level) || (ast_opt_verb_module && ast_verbose_get_by_module(AST_MODULE) >= (level))) -#define ast_verb(level, ...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, __VA_ARGS__) +#define ast_verb(level, ...) do { \ + if (VERBOSITY_ATLEAST((level)) ) { \ + if (level >= 4) \ + ast_verbose(VERBOSE_PREFIX_4 __VA_ARGS__); \ + else if (level == 3) \ + ast_verbose(VERBOSE_PREFIX_3 __VA_ARGS__); \ + else if (level == 2) \ + ast_verbose(VERBOSE_PREFIX_2 __VA_ARGS__); \ + else if (level == 1) \ + ast_verbose(VERBOSE_PREFIX_1 __VA_ARGS__); \ + else \ + ast_verbose(__VA_ARGS__); \ + } \ +} while (0) #ifndef _LOGGER_BACKTRACE_H #define _LOGGER_BACKTRACE_H -- cgit v1.2.3