]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add userdata param to switch_log_printf so we can pass uuid or other session or other...
authorMichael Jerris <mike@jerris.com>
Wed, 20 Jun 2007 09:19:45 +0000 (09:19 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 20 Jun 2007 09:19:45 +0000 (09:19 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5412 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_log.h
src/include/switch_types.h
src/switch_channel.c
src/switch_core_io.c
src/switch_core_session.c
src/switch_log.c

index 8cc8b1e6463823c022043f0399a9408887098f77..7f15f72093e9bb2ab6c03f396fa1dc47e22301dd 100644 (file)
@@ -61,7 +61,7 @@ SWITCH_BEGIN_EXTERN_C
        switch_time_t timestamp;
        /*! A pointer to where the actual content of the message starts (skipping past the preformatted portion) */
        char *content;
-
+       const char *userdata;
        /* To maintain abi, only add new elements to the end of this struct and do not delete any elements */
 
 } switch_log_node_t;
@@ -95,7 +95,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void);
   \note there are channel macros to supply the first 4 parameters
 */
 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
-                                                                          switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(6, 7);
+                                                                          const char *userdata, switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(6, 7);
 
 /*! 
   \brief Shut down  the logging engine
index fa54220b528d4f384e39890d98c8587e9a5a4068..021f1e88ab82ded2b479a9da2d02127391122356 100644 (file)
@@ -511,9 +511,9 @@ typedef enum {
        SCSMF_DYNAMIC = (1 << 0)
 } switch_core_session_message_flag_t;
 
-#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__
-#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__
-#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__
+#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
+#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
+#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
 
 /*!
   \enum switch_channel_state_t
index 36ff1b1cf62f21e3a354b7b628dab20370ec8b93..4bf7337ace5ff6386f01825ec7fb5564f71395f4 100644 (file)
@@ -711,7 +711,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
                if (state > CS_RING) {
                        switch_channel_presence(channel, "unknown", (char *) state_names[state]);
                }
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
                                                  channel->name, state_names[last_state], state_names[state]);
                switch_mutex_lock(channel->flag_mutex);
                channel->state = state;
@@ -742,7 +742,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
                }
 
        } else {
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_WARNING,
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
                                                  "%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], state_names[state]);
 
                /* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */
@@ -1049,7 +1049,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
                switch_channel_state_t last_state = channel->state;
                channel->state = CS_HANGUP;
                channel->hangup_cause = hangup_cause;
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
                                                  channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
                if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", switch_channel_cause2str(channel->hangup_cause));
@@ -1072,7 +1072,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
 {
        if (!switch_channel_test_flag(channel, CF_RING_READY)) {
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
                switch_channel_set_flag(channel, CF_RING_READY);
                return SWITCH_STATUS_SUCCESS;
        }
@@ -1092,7 +1092,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
                char *uuid;
                switch_core_session_t *other_session;
 
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
                switch_channel_set_flag(channel, CF_EARLY_MEDIA);
                switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
                if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) {
@@ -1168,7 +1168,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel
        status = switch_core_session_receive_message(channel->session, &msg);
 
        if (status == SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
        }
 
        return status;
@@ -1213,7 +1213,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
        }
 
        switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
-       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
+       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
 
        return SWITCH_STATUS_SUCCESS;
 }
index fd44dbe387d6ca1bed88c0ae988c3a7550d839be..fefe4588a613ada6be8647a1a39d79e1c4c37b5f 100644 (file)
@@ -746,7 +746,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(switch_
        switch_io_event_hook_kill_channel_t *ptr;
        switch_status_t status = SWITCH_STATUS_FALSE;
 
-       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "Kill %s [%s]\n", switch_channel_get_name(session->channel),
+       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "Kill %s [%s]\n", switch_channel_get_name(session->channel),
                                          SIG_NAMES[sig]);
 
        if (session->endpoint_interface->io_routines->kill_channel) {
index 8a77f8534401e19a0ae1b9134d57fbe6a4a969a0..f2ea95c7576b3c48d1e8a1260f091266ff2fd287 100644 (file)
@@ -658,7 +658,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
        switch_memory_pool_t *pool;
        switch_event_t *event;
 
-       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n", 
+       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n", 
                                          switch_channel_get_name((*session)->channel),
                                          switch_channel_state_name(switch_channel_get_state((*session)->channel)));
        
index 1b670f4314dffc9845d5f917ff894785b37b8ae4..77edd3d0ba2e79ab4e094c09539366ea2288995d 100644 (file)
@@ -164,7 +164,7 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t * thread, void *obj)
 }
 
 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
-                                                                          switch_log_level_t level, const char *fmt, ...)
+                                                                          const char *userdata, switch_log_level_t level, const char *fmt, ...)
 {
        char *data = NULL;
        char *new_fmt = NULL;