[Freeswitch-svn] [commit] r1830 - freeswitch/trunk/src/mod/loggers/mod_syslog
Freeswitch SVN
anthm at freeswitch.org
Tue Jul 11 13:39:50 EDT 2006
Author: anthm
Date: Tue Jul 11 13:39:50 2006
New Revision: 1830
Modified:
freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c
Log:
fix logical error
Modified: freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c (original)
+++ freeswitch/trunk/src/mod/loggers/mod_syslog/mod_syslog.c Tue Jul 11 13:39:50 2006
@@ -106,12 +106,15 @@
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
{
*interface = &console_module_interface;
+ switch_status_t status;
- switch_log_bind_logger(mod_syslog_logger, SWITCH_LOG_DEBUG);
+ if ((status=load_config()) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
- load_config();
-
openlog(globals.ident, LOG_PID, LOG_USER);
+
+ switch_log_bind_logger(mod_syslog_logger, SWITCH_LOG_DEBUG);
return SWITCH_STATUS_SUCCESS;
}
@@ -129,27 +132,28 @@
char *var, *val;
char *cf = "syslog.conf";
- if (!switch_config_open_file(&cfg, cf)) {
+ memset(&globals, 0, sizeof(globals));
+
+ if (switch_config_open_file(&cfg, cf)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
- return SWITCH_STATUS_TERM;
- }
- while (switch_config_next_pair(&cfg, &var, &val)) {
- if (!strcasecmp(cfg.category, "settings")) {
- if (!strcmp(var, "ident")) {
- set_global_ident(val);
- } else if (!strcmp(var, "facility")) {
- set_global_facility(val);
- } else if (!strcmp(var, "format")) {
- set_global_format(val);
- } else if (!strcmp(var, "level")) {
- set_global_level(val);;
+ while (switch_config_next_pair(&cfg, &var, &val)) {
+ if (!strcasecmp(cfg.category, "settings")) {
+ if (!strcmp(var, "ident")) {
+ set_global_ident(val);
+ } else if (!strcmp(var, "facility")) {
+ set_global_facility(val);
+ } else if (!strcmp(var, "format")) {
+ set_global_format(val);
+ } else if (!strcmp(var, "level")) {
+ set_global_level(val);;
+ }
}
}
+
+ switch_config_close_file(&cfg);
}
- switch_config_close_file(&cfg);
-
if (switch_strlen_zero(globals.ident)) {
set_global_ident(DEFAULT_IDENT);
}
More information about the Freeswitch-svn
mailing list