mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-02 11:19:28 +00:00
add adjustable log level and sps via fsctl
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5793 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7c125a5d19
commit
0b9482f1fd
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user