summaryrefslogtreecommitdiff
path: root/main/logger.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-04-16 22:57:54 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-04-16 22:57:54 +0000
commit123ac5fd646cb7a0ed3b7055cda609db93c20487 (patch)
tree6dea5b8c8d8bb81a47195b75172db608ff217382 /main/logger.c
parent752f6681b1ea748a1acef2a55e17c4c564715fde (diff)
Standardized routines for forking processes (keeps all the specialized code in one place).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/main/logger.c b/main/logger.c
index b7c517fa7..dce2097d9 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -413,6 +413,55 @@ static void init_logger_chain(int reload, int locked)
ast_config_destroy(cfg);
}
+void ast_child_verbose(int level, const char *fmt, ...)
+{
+ char *msg = NULL, *emsg = NULL, *sptr, *eptr;
+ va_list ap, aq;
+ int size;
+
+ /* Don't bother, if the level isn't that high */
+ if (option_verbose < level) {
+ return;
+ }
+
+ va_start(ap, fmt);
+ va_copy(aq, ap);
+ if ((size = vsnprintf(msg, 0, fmt, ap)) < 0) {
+ va_end(ap);
+ va_end(aq);
+ return;
+ }
+ va_end(ap);
+
+ if (!(msg = ast_malloc(size + 1))) {
+ va_end(aq);
+ return;
+ }
+
+ vsnprintf(msg, size + 1, fmt, aq);
+ va_end(aq);
+
+ if (!(emsg = ast_malloc(size * 2 + 1))) {
+ ast_free(msg);
+ return;
+ }
+
+ for (sptr = msg, eptr = emsg; ; sptr++) {
+ if (*sptr == '"') {
+ *eptr++ = '\\';
+ }
+ *eptr++ = *sptr;
+ if (*sptr == '\0') {
+ break;
+ }
+ }
+ ast_free(msg);
+
+ fprintf(stdout, "verbose \"%s\" %d\n", emsg, level);
+ fflush(stdout);
+ ast_free(emsg);
+}
+
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
{
va_list ap;