add optional level argument to info app to choose the log level it logs on
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14643 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
797998f014
commit
35a008b08b
|
@ -938,12 +938,17 @@ SWITCH_STANDARD_APP(info_function)
|
|||
{
|
||||
switch_event_t *event;
|
||||
char *buf;
|
||||
int level = SWITCH_LOG_INFO;
|
||||
|
||||
if (data) {
|
||||
level = switch_log_str2level(data);
|
||||
}
|
||||
|
||||
if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(switch_core_session_get_channel(session), event);
|
||||
switch_event_serialize(event, &buf, SWITCH_FALSE);
|
||||
switch_assert(buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), level, "CHANNEL_DATA:\n%s\n", buf);
|
||||
switch_event_destroy(&event);
|
||||
free(buf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue