mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-19 01:34:13 +00:00
indent pass 2
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8689 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
9bbcabbbdd
commit
f930eaeec7
101 files changed
+31644
-31458
No files matched your search
@@ -84,14 +84,14 @@ static void add_mapping(char *var, char *val, int cumlative)
|
||||
} else {
|
||||
m = switch_log_str2mask(val);
|
||||
}
|
||||
|
||||
|
||||
if (!strcasecmp(var, "all")) {
|
||||
all_level |= m;
|
||||
return;
|
||||
}
|
||||
|
||||
del_mapping(var);
|
||||
switch_core_hash_insert(log_hash, var, (void *)(intptr_t) m);
|
||||
switch_core_hash_insert(log_hash, var, (void *) (intptr_t) m);
|
||||
}
|
||||
|
||||
static switch_status_t config_logger(void)
|
||||
@@ -149,7 +149,7 @@ static switch_status_t config_logger(void)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static int can_write(FILE *handle, int ms)
|
||||
static int can_write(FILE * handle, int ms)
|
||||
{
|
||||
#ifndef WIN32
|
||||
int aok = 1;
|
||||
@@ -166,14 +166,14 @@ static int can_write(FILE *handle, int ms)
|
||||
FD_SET(fd, &can_write);
|
||||
to.tv_sec = sec;
|
||||
to.tv_usec = usec;
|
||||
if (select(fd+1, NULL, &can_write, NULL, &to) > 0) {
|
||||
if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {
|
||||
aok = FD_ISSET(fd, &can_write);
|
||||
} else {
|
||||
aok = 0;
|
||||
}
|
||||
|
||||
|
||||
return aok;
|
||||
#else
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
@@ -182,11 +182,10 @@ static int can_write(FILE *handle, int ms)
|
||||
static switch_status_t switch_console_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
FILE *handle;
|
||||
|
||||
|
||||
if (!RUNNING) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (failed_write) {
|
||||
if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
|
||||
@@ -197,7 +196,7 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", msg);
|
||||
#else
|
||||
if (COLORIZE) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s", COLORS[1], msg, SWITCH_SEQ_DEFAULT_COLOR);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s", COLORS[1], msg, SWITCH_SEQ_DEFAULT_COLOR);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", msg);
|
||||
}
|
||||
@@ -213,11 +212,11 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
|
||||
}
|
||||
|
||||
if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
|
||||
size_t mask = 0;
|
||||
size_t ok = 0;
|
||||
|
||||
ok = switch_log_check_mask(all_level, level);
|
||||
|
||||
size_t mask = 0;
|
||||
size_t ok = 0;
|
||||
|
||||
ok = switch_log_check_mask(all_level, level);
|
||||
|
||||
if (log_hash) {
|
||||
if (!ok) {
|
||||
mask = (size_t) switch_core_hash_find(log_hash, node->file);
|
||||
@@ -233,7 +232,7 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
|
||||
if (ok) {
|
||||
#ifndef WIN32
|
||||
int aok = can_write(handle, 10000);
|
||||
|
||||
|
||||
if (!aok) {
|
||||
//hard_log_level = 0;
|
||||
//failed_write++;
|
||||
@@ -261,18 +260,18 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
|
||||
SWITCH_STANDARD_API(console_api_function)
|
||||
{
|
||||
int argc;
|
||||
char *mydata = NULL, *argv[3];
|
||||
char *mydata = NULL, *argv[3];
|
||||
const char *err = NULL;
|
||||
|
||||
if (!cmd) {
|
||||
err = "bad args";
|
||||
goto end;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
|
||||
mydata = strdup(cmd);
|
||||
assert(mydata);
|
||||
|
||||
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
mydata = strdup(cmd);
|
||||
assert(mydata);
|
||||
|
||||
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
|
||||
if (argc > 0) {
|
||||
|
||||
@@ -283,7 +282,7 @@ SWITCH_STANDARD_API(console_api_function)
|
||||
|
||||
if (!strcasecmp(argv[0], "loglevel")) {
|
||||
int level = hard_log_level;
|
||||
|
||||
|
||||
if (argc > 1) {
|
||||
if (*argv[1] > 47 && *argv[1] < 58) {
|
||||
level = atoi(argv[1]);
|
||||
@@ -296,26 +295,26 @@ SWITCH_STANDARD_API(console_api_function)
|
||||
stream->write_function(stream, "-ERR syntax error, console log level not set!\n");
|
||||
} else {
|
||||
hard_log_level = level;
|
||||
stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
|
||||
stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
|
||||
}
|
||||
goto end;
|
||||
} else if (!strcasecmp(argv[0], "colorize")) {
|
||||
if (argc > 1) {
|
||||
COLORIZE = switch_true(argv[1]);
|
||||
}
|
||||
stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
|
||||
stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
err = "invalid command";
|
||||
|
||||
}
|
||||
|
||||
|
||||
end:
|
||||
|
||||
end:
|
||||
|
||||
if (err) {
|
||||
stream->write_function(stream, "-Error %s\n", err);
|
||||
stream->write_function(stream, "-Error %s\n", err);
|
||||
}
|
||||
|
||||
|
||||
@@ -328,10 +327,10 @@ SWITCH_STANDARD_API(console_api_function)
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_console_load)
|
||||
{
|
||||
switch_api_interface_t *api_interface;
|
||||
|
||||
|
||||
|
||||
module_pool = pool;
|
||||
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_logfile_load);
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown);
|
||||
SWITCH_MODULE_DEFINITION(mod_logfile, mod_logfile_load, mod_logfile_shutdown, NULL);
|
||||
|
||||
#define DEFAULT_LIMIT 0xA00000 /* About 10 MB */
|
||||
#define DEFAULT_LIMIT 0xA00000 /* About 10 MB */
|
||||
#define WARM_FUZZY_OFFSET 256
|
||||
#define MAX_ROT 4096 /* why not */
|
||||
#define MAX_ROT 4096 /* why not */
|
||||
|
||||
static switch_memory_pool_t *module_pool = NULL;
|
||||
static switch_hash_t *profile_hash = NULL;
|
||||
@@ -50,12 +50,12 @@ static struct {
|
||||
|
||||
struct logfile_profile {
|
||||
char *name;
|
||||
switch_size_t log_size; /* keep the log size in check for rotation */
|
||||
switch_size_t roll_size; /* the size that we want to rotate the file at */
|
||||
switch_size_t log_size; /* keep the log size in check for rotation */
|
||||
switch_size_t roll_size; /* the size that we want to rotate the file at */
|
||||
char *logfile;
|
||||
switch_file_t *log_afd;
|
||||
switch_hash_t *log_hash;
|
||||
uint32_t all_level;
|
||||
switch_hash_t *log_hash;
|
||||
uint32_t all_level;
|
||||
};
|
||||
|
||||
typedef struct logfile_profile logfile_profile_t;
|
||||
@@ -76,7 +76,7 @@ static void add_mapping(logfile_profile_t *profile, char *var, char *val)
|
||||
return;
|
||||
}
|
||||
|
||||
switch_core_hash_insert(profile->log_hash, var, (void *)(intptr_t) switch_log_str2mask(val));
|
||||
switch_core_hash_insert(profile->log_hash, var, (void *) (intptr_t) switch_log_str2mask(val));
|
||||
}
|
||||
|
||||
static switch_status_t mod_logfile_rotate(logfile_profile_t *profile);
|
||||
@@ -92,7 +92,7 @@ static switch_status_t mod_logfile_openlogfile(logfile_profile_t *profile, switc
|
||||
flags |= SWITCH_FOPEN_WRITE;
|
||||
flags |= SWITCH_FOPEN_APPEND;
|
||||
|
||||
stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD|SWITCH_FPROT_UWRITE, module_pool);
|
||||
stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool);
|
||||
if (stat != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -136,15 +136,15 @@ static switch_status_t mod_logfile_rotate(logfile_profile_t *profile)
|
||||
}
|
||||
|
||||
|
||||
p = malloc(strlen(profile->logfile)+WARM_FUZZY_OFFSET);
|
||||
p = malloc(strlen(profile->logfile) + WARM_FUZZY_OFFSET);
|
||||
switch_assert(p);
|
||||
|
||||
memset(p, '\0', strlen(profile->logfile)+WARM_FUZZY_OFFSET);
|
||||
memset(p, '\0', strlen(profile->logfile) + WARM_FUZZY_OFFSET);
|
||||
|
||||
switch_core_new_memory_pool(&pool);
|
||||
|
||||
for (i=1; i < MAX_ROT; i++) {
|
||||
sprintf((char *)p, "%s.%s.%i", profile->logfile, date, i);
|
||||
for (i = 1; i < MAX_ROT; i++) {
|
||||
sprintf((char *) p, "%s.%s.%i", profile->logfile, date, i);
|
||||
if (switch_file_exists(p, pool) == SWITCH_STATUS_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
@@ -152,9 +152,9 @@ static switch_status_t mod_logfile_rotate(logfile_profile_t *profile)
|
||||
switch_file_close(profile->log_afd);
|
||||
switch_file_rename(profile->logfile, p, pool);
|
||||
if ((status = mod_logfile_openlogfile(profile, SWITCH_FALSE)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Rotating Log!\n");
|
||||
goto end;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Rotating Log!\n");
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ static switch_status_t mod_logfile_rotate(logfile_profile_t *profile)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New log started.\n");
|
||||
|
||||
end:
|
||||
end:
|
||||
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
@@ -175,7 +175,7 @@ end:
|
||||
static switch_status_t mod_logfile_raw_write(logfile_profile_t *profile, char *log_data)
|
||||
{
|
||||
switch_size_t len;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
len = strlen(log_data);
|
||||
|
||||
if (len <= 0 || !profile->log_afd) {
|
||||
@@ -187,96 +187,96 @@ static switch_status_t mod_logfile_raw_write(logfile_profile_t *profile, char *l
|
||||
if (switch_file_write(profile->log_afd, log_data, &len) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_file_close(profile->log_afd);
|
||||
if ((status = mod_logfile_openlogfile(profile, SWITCH_TRUE)) == SWITCH_STATUS_SUCCESS) {
|
||||
len = strlen(log_data);
|
||||
switch_file_write(profile->log_afd, log_data, &len);
|
||||
}
|
||||
len = strlen(log_data);
|
||||
switch_file_write(profile->log_afd, log_data, &len);
|
||||
}
|
||||
}
|
||||
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
profile->log_size += len;
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
profile->log_size += len;
|
||||
|
||||
if (profile->roll_size && profile->log_size >= profile->roll_size) {
|
||||
mod_logfile_rotate(profile);
|
||||
}
|
||||
}
|
||||
if (profile->roll_size && profile->log_size >= profile->roll_size) {
|
||||
mod_logfile_rotate(profile);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t process_node(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *var;
|
||||
logfile_profile_t *profile;
|
||||
|
||||
for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
size_t mask = 0;
|
||||
size_t ok = 0;
|
||||
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
profile = val;
|
||||
|
||||
ok = switch_log_check_mask(profile->all_level, level);
|
||||
|
||||
if (!ok) {
|
||||
mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);
|
||||
ok = switch_log_check_mask(mask, level);
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);
|
||||
ok = switch_log_check_mask(mask, level);
|
||||
}
|
||||
for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
size_t mask = 0;
|
||||
size_t ok = 0;
|
||||
|
||||
if (ok) {
|
||||
mod_logfile_raw_write(profile, node->data);
|
||||
}
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
profile = val;
|
||||
|
||||
}
|
||||
ok = switch_log_check_mask(profile->all_level, level);
|
||||
|
||||
if (!ok) {
|
||||
mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);
|
||||
ok = switch_log_check_mask(mask, level);
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);
|
||||
ok = switch_log_check_mask(mask, level);
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
mod_logfile_raw_write(profile, node->data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t mod_logfile_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
return process_node(node, level);
|
||||
return process_node(node, level);
|
||||
}
|
||||
|
||||
static switch_status_t load_profile(switch_xml_t xml)
|
||||
{
|
||||
switch_xml_t param, settings;
|
||||
char *name = (char *) switch_xml_attr_soft(xml, "name");
|
||||
logfile_profile_t *new_profile;
|
||||
char *name = (char *) switch_xml_attr_soft(xml, "name");
|
||||
logfile_profile_t *new_profile;
|
||||
|
||||
new_profile = switch_core_alloc(module_pool, sizeof(*new_profile));
|
||||
memset(new_profile, 0, sizeof(*new_profile));
|
||||
switch_core_hash_init(&(new_profile->log_hash), module_pool);
|
||||
new_profile->name = switch_core_strdup(module_pool, switch_str_nil(name));
|
||||
|
||||
|
||||
new_profile = switch_core_alloc(module_pool, sizeof(*new_profile));
|
||||
memset(new_profile, 0, sizeof(*new_profile));
|
||||
switch_core_hash_init(&(new_profile->log_hash), module_pool);
|
||||
new_profile->name = switch_core_strdup(module_pool, switch_str_nil(name));
|
||||
|
||||
|
||||
if ((settings = switch_xml_child(xml, "settings"))) {
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
if (!strcmp(var, "logfile")) {
|
||||
new_profile->logfile = strdup(val);
|
||||
} else if (!strcmp(var, "rollover")) {
|
||||
new_profile->roll_size = atoi(val);
|
||||
if (new_profile->roll_size < 0) {
|
||||
new_profile->roll_size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
if (!strcmp(var, "logfile")) {
|
||||
new_profile->logfile = strdup(val);
|
||||
} else if (!strcmp(var, "rollover")) {
|
||||
new_profile->roll_size = atoi(val);
|
||||
if (new_profile->roll_size < 0) {
|
||||
new_profile->roll_size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((settings = switch_xml_child(xml, "mappings"))) {
|
||||
for (param = switch_xml_child(settings, "map"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
|
||||
add_mapping(new_profile, var, val);
|
||||
}
|
||||
}
|
||||
@@ -286,40 +286,40 @@ static switch_status_t load_profile(switch_xml_t xml)
|
||||
switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
|
||||
new_profile->logfile = strdup(logfile);
|
||||
}
|
||||
|
||||
if (mod_logfile_openlogfile(new_profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
switch_core_hash_insert(profile_hash, new_profile->name, (void *) new_profile);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
if (mod_logfile_openlogfile(new_profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
switch_core_hash_insert(profile_hash, new_profile->name, (void *) new_profile);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void event_handler(switch_event_t *event)
|
||||
{
|
||||
const char *sig = switch_event_get_header(event, "Trapped-Signal");
|
||||
switch_hash_index_t *hi;
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *var;
|
||||
logfile_profile_t *profile;
|
||||
|
||||
if (sig && !strcmp(sig, "HUP")) {
|
||||
if (globals.rotate) {
|
||||
for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
profile = val;
|
||||
mod_logfile_rotate(profile);
|
||||
}
|
||||
} else {
|
||||
switch_mutex_lock(globals.mutex);
|
||||
for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
profile = val;
|
||||
switch_file_close(profile->log_afd);
|
||||
if (mod_logfile_openlogfile(profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!\n");
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!\n");
|
||||
}
|
||||
}
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
}
|
||||
@@ -364,11 +364,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_logfile_load)
|
||||
|
||||
if ((profiles = switch_xml_child(cfg, "profiles"))) {
|
||||
for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
|
||||
if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_xml_free(xml);
|
||||
}
|
||||
|
||||
@@ -54,16 +54,16 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format);
|
||||
|
||||
static switch_loadable_module_interface_t console_module_interface = {
|
||||
/*.module_name */ modname,
|
||||
/*.endpoint_interface */ NULL,
|
||||
/*.timer_interface */ NULL,
|
||||
/*.dialplan_interface */ NULL,
|
||||
/*.codec_interface */ NULL,
|
||||
/*.application_interface */ NULL,
|
||||
/*.api_interface */ NULL,
|
||||
/*.file_interface */ NULL,
|
||||
/*.speech_interface */ NULL,
|
||||
/*.directory_interface */ NULL
|
||||
/*.module_name */ modname,
|
||||
/*.endpoint_interface */ NULL,
|
||||
/*.timer_interface */ NULL,
|
||||
/*.dialplan_interface */ NULL,
|
||||
/*.codec_interface */ NULL,
|
||||
/*.application_interface */ NULL,
|
||||
/*.api_interface */ NULL,
|
||||
/*.file_interface */ NULL,
|
||||
/*.speech_interface */ NULL,
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
@@ -72,30 +72,30 @@ static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_l
|
||||
int syslog_level;
|
||||
|
||||
switch (level) {
|
||||
case SWITCH_LOG_DEBUG:
|
||||
syslog_level = LOG_DEBUG;
|
||||
break;
|
||||
case SWITCH_LOG_INFO:
|
||||
syslog_level = LOG_INFO;
|
||||
break;
|
||||
case SWITCH_LOG_NOTICE:
|
||||
syslog_level = LOG_NOTICE;
|
||||
break;
|
||||
case SWITCH_LOG_WARNING:
|
||||
syslog_level = LOG_WARNING;
|
||||
break;
|
||||
case SWITCH_LOG_ERROR:
|
||||
syslog_level = LOG_ERR;
|
||||
break;
|
||||
case SWITCH_LOG_CRIT:
|
||||
syslog_level = LOG_CRIT;
|
||||
break;
|
||||
case SWITCH_LOG_ALERT:
|
||||
syslog_level = LOG_ALERT;
|
||||
break;
|
||||
default:
|
||||
syslog_level = LOG_NOTICE;
|
||||
break;
|
||||
case SWITCH_LOG_DEBUG:
|
||||
syslog_level = LOG_DEBUG;
|
||||
break;
|
||||
case SWITCH_LOG_INFO:
|
||||
syslog_level = LOG_INFO;
|
||||
break;
|
||||
case SWITCH_LOG_NOTICE:
|
||||
syslog_level = LOG_NOTICE;
|
||||
break;
|
||||
case SWITCH_LOG_WARNING:
|
||||
syslog_level = LOG_WARNING;
|
||||
break;
|
||||
case SWITCH_LOG_ERROR:
|
||||
syslog_level = LOG_ERR;
|
||||
break;
|
||||
case SWITCH_LOG_CRIT:
|
||||
syslog_level = LOG_CRIT;
|
||||
break;
|
||||
case SWITCH_LOG_ALERT:
|
||||
syslog_level = LOG_ALERT;
|
||||
break;
|
||||
default:
|
||||
syslog_level = LOG_NOTICE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!switch_strlen_zero(message)) {
|
||||
|
||||
Reference in new issue
Block a user