summaryrefslogtreecommitdiff
path: root/include/asterisk/logger.h
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2011-11-29 18:43:16 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2011-11-29 18:43:16 +0000
commit77b670c4ab62db2fa2386e15aa6ae4860bb401c9 (patch)
treefba9c5d22c4c3dea695dac6c51a49316f6381b4d /include/asterisk/logger.h
parentd7dec4f14fc018d18ed480358f9a265b81b230b9 (diff)
Allow each logging destination and console to have its own notion of the verbosity level.
Review: https://reviewboard.asterisk.org/r/1599 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/logger.h')
-rw-r--r--include/asterisk/logger.h34
1 files changed, 11 insertions, 23 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 9363caa74..a3e436d44 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -68,19 +68,20 @@ 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 abscence of a comma after the VERBOSE_PREFIX_3. This is important.
- VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined.
+ * \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
*/
-void __attribute__((format(printf, 4, 5))) __ast_verbose(const char *file, int line, const char *func, const char *fmt, ...);
+void __attribute__((format(printf, 5, 6))) __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt, ...);
-#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
+#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, __VA_ARGS__)
-void __attribute__((format(printf, 4, 0))) __ast_verbose_ap(const char *file, int line, const char *func, const char *fmt, va_list ap);
+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);
-#define ast_verbose_ap(fmt, ap) __ast_verbose_ap(__FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ap)
+#define ast_verbose_ap(fmt, ap) __ast_verbose_ap(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, fmt, ap)
void __attribute__((format(printf, 2, 3))) ast_child_verbose(int level, const char *fmt, ...);
@@ -240,20 +241,7 @@ 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, ...) 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)
+#define ast_verb(level, ...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, level, __VA_ARGS__)
#ifndef _LOGGER_BACKTRACE_H
#define _LOGGER_BACKTRACE_H