mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 06:34:19 +00:00
FS-11693 [core] Added switch_channel_set_log_tag() and switch_channel_get_log_tags() This allows you to add log tags to an active call channel. If using SWITCH_CHANNEL_SESSION_LOG, with switch_log_printf(), the tags will be added to the the log node so a logging module can send additional contextual data to a log aggregator.
This commit is contained in:
1 parent
2e319c41c0
commit
e4c0abf286
4 files changed
+50
No files matched your search
@@ -125,6 +125,10 @@ SWITCH_DECLARE(switch_log_node_t *) switch_log_node_dup(const switch_log_node_t
|
||||
switch_assert(newnode->userdata);
|
||||
}
|
||||
|
||||
if (node->tags) {
|
||||
switch_event_dup(&newnode->tags, node->tags);
|
||||
}
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
@@ -141,6 +145,9 @@ SWITCH_DECLARE(void) switch_log_node_free(switch_log_node_t **pnode)
|
||||
if (node) {
|
||||
switch_safe_free(node->userdata);
|
||||
switch_safe_free(node->data);
|
||||
if (node->tags) {
|
||||
switch_event_destroy(&node->tags);
|
||||
}
|
||||
#ifdef SWITCH_LOG_RECYCLE
|
||||
if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
|
||||
free(node);
|
||||
@@ -490,9 +497,13 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha
|
||||
node->content = content;
|
||||
node->timestamp = now;
|
||||
node->channel = channel;
|
||||
node->tags = NULL;
|
||||
if (channel == SWITCH_CHANNEL_ID_SESSION) {
|
||||
switch_core_session_t *session = (switch_core_session_t *) userdata;
|
||||
node->userdata = userdata ? strdup(switch_core_session_get_uuid(session)) : NULL;
|
||||
if (session) {
|
||||
switch_channel_get_log_tags(switch_core_session_get_channel(session), &node->tags);
|
||||
}
|
||||
} else {
|
||||
node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user