diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 73c0925828..caba919612 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -388,6 +388,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype) = 0; + SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg); }; diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index ad66210c72..0757026296 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -1221,6 +1221,18 @@ SWITCH_DECLARE(void) CoreSession::setHangupHook(void *hangup_func) { switch_core_event_hook_add_state_change(session, hanguphook); } +SWITCH_DECLARE(void) CoreSession::consoleLog(char *level_str, char *msg) +{ + switch_log_level_t level = SWITCH_LOG_DEBUG; + if (level_str) { + level = switch_log_str2level(level_str); + if (level == SWITCH_LOG_INVALID) { + level = SWITCH_LOG_DEBUG; + } + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), level, "%s", switch_str_nil(msg)); +} + /* ---- methods not bound to CoreSession instance ---- */