提交 0b9482f1 authored 作者: Anthony Minessale's avatar Anthony Minessale

add adjustable log level and sps via fsctl

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5793 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 7c125a5d
......@@ -1008,7 +1008,8 @@ typedef enum {
SCSC_HUPALL,
SCSC_SHUTDOWN,
SCSC_CHECK_RUNNING,
SCSC_LOGLEVEL
SCSC_LOGLEVEL,
SCSC_SPS
} switch_session_ctl_t;
typedef struct apr_pool_t switch_memory_pool_t;
......
......@@ -127,7 +127,15 @@ SWITCH_STANDARD_API(ctl_function)
arg = -1;
}
switch_core_session_ctl(SCSC_LOGLEVEL, &arg);
stream->write_function(stream, "log level %s [%d]\n", switch_log_level2str(arg), arg);
stream->write_function(stream, "log level: %s [%d]\n", switch_log_level2str(arg), arg);
} else if (!strcasecmp(argv[0], "sps")) {
if (argc > 1) {
arg = atoi(argv[1]);
} else {
arg = 0;
}
switch_core_session_ctl(SCSC_SPS, &arg);
stream->write_function(stream, "sessions per second: %d\n", arg);
} else {
stream->write_function(stream, "INVALID COMMAND\nUSAGE: fsctl [hupall|pause|resume|shutdown]\n");
goto end;
......
......@@ -648,16 +648,22 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_
break;
case SCSC_LOGLEVEL:
if (*val > -1) {
printf("WTF %d\n", *val);
runtime.hard_log_level = *val;
}
if (runtime.hard_log_level > SWITCH_LOG_CONSOLE) {
printf("WTF %d\n", *val);
runtime.hard_log_level = SWITCH_LOG_CONSOLE;
}
*val = runtime.hard_log_level;
break;
case SCSC_SPS:
switch_mutex_lock(runtime.throttle_mutex);
if (*val > 0) {
runtime.sps_total = *val;
}
*val = runtime.sps_total;
switch_mutex_unlock(runtime.throttle_mutex);
break;
}
return 0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论