From 5eb94d7ebbc2c29d4de8201103bcb62ae8afcd31 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Tue, 26 Jun 2012 21:45:22 +0000 Subject: Unique Call ID logging Phases III and IV Adds call ID logging changes to specific channel drivers that weren't handled handled in phase II of Call ID Logging. Also covers logging for threads for threads created by systems that may be involved with many different calls. Extra special thanks to Richard for rigorous review of chan_dahdi and its various signalling modules. review: https://reviewboard.asterisk.org/r/1927/ review: https://reviewboard.asterisk.org/r/1950/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369414 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/logger.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'main/logger.c') diff --git a/main/logger.c b/main/logger.c index 6bfafe97d..ca2648190 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1691,7 +1691,7 @@ void ast_backtrace(void) #endif /* defined(HAVE_BKTR) */ } -void __ast_verbose_ap(const char *file, int line, const char *func, int level, const char *fmt, va_list ap) +void __ast_verbose_ap(const char *file, int line, const char *func, int level, struct ast_callid *callid, const char *fmt, va_list ap) { struct ast_str *buf = NULL; int res = 0; @@ -1743,15 +1743,30 @@ void __ast_verbose_ap(const char *file, int line, const char *func, int level, c return; } - ast_log(__LOG_VERBOSE, file, line, func, "%s", ast_str_buffer(buf)); + ast_log_callid(__LOG_VERBOSE, file, line, func, callid, "%s", ast_str_buffer(buf)); } void __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt, ...) { + struct ast_callid *callid; va_list ap; + callid = ast_read_threadstorage_callid(); + + va_start(ap, fmt); + __ast_verbose_ap(file, line, func, level, callid, fmt, ap); + va_end(ap); + + if (callid) { + ast_callid_unref(callid); + } +} + +void __ast_verbose_callid(const char *file, int line, const char *func, int level, struct ast_callid *callid, const char *fmt, ...) +{ + va_list ap; va_start(ap, fmt); - __ast_verbose_ap(file, line, func, level, fmt, ap); + __ast_verbose_ap(file, line, func, level, callid, fmt, ap); va_end(ap); } @@ -1760,11 +1775,18 @@ void __ast_verbose(const char *file, int line, const char *func, int level, cons void __attribute__((format(printf, 1,2))) ast_verbose(const char *fmt, ...); void ast_verbose(const char *fmt, ...) { + struct ast_callid *callid; va_list ap; + callid = ast_read_threadstorage_callid(); + va_start(ap, fmt); - __ast_verbose_ap("", 0, "", 0, fmt, ap); + __ast_verbose_ap("", 0, "", 0, callid, fmt, ap); va_end(ap); + + if (callid) { + ast_callid_unref(callid); + } } int ast_register_verbose(void (*v)(const char *string)) -- cgit v1.2.3