SCF_CPF_SOFT_LOOKUP = (1 << 26),
SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27),
SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE = (1 << 28),
- SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29)
+ SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29),
+ SCF_LOG_DISABLE = (1 << 30)
} switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t;
SWITCH_LOG_CRIT = 2,
SWITCH_LOG_ALERT = 1,
SWITCH_LOG_CONSOLE = 0,
+ SWITCH_LOG_DISABLE = -1,
SWITCH_LOG_INVALID = 64,
- SWITCH_LOG_UNINIT = 1000,
+ SWITCH_LOG_UNINIT = 1000
} switch_log_level_t;
switch_memory_pool_t *fst_pool = NULL; \
int fst_timer_started = 0; \
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
- if (fst_init_core_and_modload(confdir, confdir, 0, flags) == SWITCH_STATUS_SUCCESS) { \
+ if (fst_init_core_and_modload(confdir, confdir, 0, flags | SCF_LOG_DISABLE) == SWITCH_STATUS_SUCCESS) { \
fst_core = 2; \
} else { \
fprintf(stderr, "Failed to load FS core\n"); \
switch_memory_pool_t *fst_pool = NULL; \
int fst_timer_started = 0; \
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
- if (fst_init_core_and_modload(confdir, NULL, 1, 0) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
+ if (fst_init_core_and_modload(confdir, NULL, 1, 0 | SCF_LOG_DISABLE) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
fst_core = 1; \
} else { \
fprintf(stderr, "Failed to load FS core\n"); \
#define FST_TEST_BEGIN(name) \
FCT_TEST_BGN(name) \
if (fst_core) { \
+ switch_log_level_t level = SWITCH_LOG_DEBUG; \
+ switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
fst_requires(fst_pool != NULL); \
if (fst_core > 1) { \
fst_requires(fst_timer_started); \
fst_requires_module(fst_test_module); \
}
-#define FST_TEST_END FCT_TEST_END
+#define FST_TEST_END \
+ if (fst_core) { \
+ switch_log_level_t level = SWITCH_LOG_DISABLE; \
+ switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
+ } \
+ FCT_TEST_END
/**
FCT_TEST_BGN(name) \
{ \
if (fst_core) { \
+ switch_log_level_t level = SWITCH_LOG_DEBUG; \
+ switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
fst_requires(fst_pool != NULL); \
if (fst_core > 1) { \
fst_requires(fst_timer_started); \
fst_session_pool = NULL; \
} \
switch_core_session_rwunlock(fst_session); \
+ if (fst_core) { \
+ switch_log_level_t level = SWITCH_LOG_DISABLE; \
+ switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
+ } \
switch_sleep(1000000); \
} \
} \
switch_set_flag((&runtime), SCF_THREADED_SYSTEM_EXEC);
#endif
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
- runtime.hard_log_level = SWITCH_LOG_DEBUG;
+ if (flags & SCF_LOG_DISABLE) {
+ runtime.hard_log_level = SWITCH_LOG_DISABLE;
+ flags &= ~SCF_LOG_DISABLE;
+ } else {
+ runtime.hard_log_level = SWITCH_LOG_DEBUG;
+ }
runtime.mailer_app = "sendmail";
runtime.mailer_app_args = "-t";
runtime.max_dtmf_duration = SWITCH_MAX_DTMF_DURATION;
newintval = runtime.running;
break;
case SCSC_LOGLEVEL:
- if (oldintval > -1) {
+ if (oldintval >= SWITCH_LOG_DISABLE) {
runtime.hard_log_level = oldintval;
}
#include "private/switch_core_pvt.h"
static const char *LEVELS[] = {
+ "DISABLE",
"CONSOLE",
"ALERT",
"CRIT",
if (level > SWITCH_LOG_DEBUG) {
level = SWITCH_LOG_DEBUG;
}
- return LEVELS[level];
+ return LEVELS[level + 1];
}
static int switch_log_to_mask(switch_log_level_t level)
}
if (!strcasecmp(LEVELS[x], str)) {
- level = (switch_log_level_t) x;
+ level = (switch_log_level_t)(x - 1);
break;
}
}
switch_log_level_t limit_level = runtime.hard_log_level;
switch_log_level_t special_level = SWITCH_LOG_UNINIT;
+ if (limit_level == SWITCH_LOG_DISABLE) {
+ return;
+ }
+
if (channel == SWITCH_CHANNEL_ID_SESSION && userdata) {
switch_core_session_t *session = (switch_core_session_t *) userdata;
special_level = session->loglevel;