[xiph-cvs] cvs commit: icecast/src config.c config.h main.c

Michael Smith msmith at xiph.org
Fri Aug 9 01:11:37 PDT 2002



msmith      02/08/09 04:11:37

  Modified:    conf     icecast.xml
               src      config.c config.h main.c
  Log:
  Allow setting the log level (for the error log, not the access log) from the
  config file.

Revision  Changes    Path
1.8       +1 -0      icecast/conf/icecast.xml

Index: icecast.xml
===================================================================
RCS file: /usr/local/cvsroot/icecast/conf/icecast.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- icecast.xml	9 Aug 2002 08:06:00 -0000	1.7
+++ icecast.xml	9 Aug 2002 08:11:36 -0000	1.8
@@ -38,6 +38,7 @@
         <logging>
                 <accesslog>access.log</accesslog>
                 <errorlog>error.log</errorlog>
+        <loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
         </logging>
 
     <security>

<p><p>1.11      +7 -1      icecast/src/config.c

Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- config.c	9 Aug 2002 06:52:07 -0000	1.10
+++ config.c	9 Aug 2002 08:11:37 -0000	1.11
@@ -19,6 +19,7 @@
 #define CONFIG_DEFAULT_PORT 8888
 #define CONFIG_DEFAULT_ACCESS_LOG "access.log"
 #define CONFIG_DEFAULT_ERROR_LOG "error.log"
+#define CONFIG_DEFAULT_LOG_LEVEL 4
 #define CONFIG_DEFAULT_CHROOT 0
 #define CONFIG_DEFAULT_CHUID 0
 #define CONFIG_DEFAULT_USER NULL
@@ -151,6 +152,7 @@
         _configuration.log_dir = (char *)strdup(CONFIG_DEFAULT_LOG_DIR);
         _configuration.access_log = (char *)strdup(CONFIG_DEFAULT_ACCESS_LOG);
         _configuration.error_log = (char *)strdup(CONFIG_DEFAULT_ERROR_LOG);
+	_configuration.loglevel = CONFIG_DEFAULT_LOG_LEVEL;
     _configuration.chroot = CONFIG_DEFAULT_CHROOT;
     _configuration.chuid = CONFIG_DEFAULT_CHUID;
     _configuration.user = CONFIG_DEFAULT_USER;
@@ -299,7 +301,11 @@
                 } else if (strcmp(node->name, "errorlog") == 0) {
                         if (_configuration.error_log) free(_configuration.error_log);
                         _configuration.error_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-		}
+		} else if (strcmp(node->name, "loglevel") == 0) {
+           char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+           _configuration.loglevel = atoi(tmp);
+           if (tmp) free(tmp);
+        }
         } while ((node = node->next));
 }
 

<p><p>1.7       +1 -0      icecast/src/config.h

Index: config.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- config.h	9 Aug 2002 06:52:07 -0000	1.6
+++ config.h	9 Aug 2002 08:11:37 -0000	1.7
@@ -43,6 +43,7 @@
 
         char *access_log;
         char *error_log;
+    int loglevel;
 
     int chroot;
     int chuid;

<p><p>1.13      +1 -1      icecast/src/main.c

Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- main.c	5 Aug 2002 14:48:01 -0000	1.12
+++ main.c	9 Aug 2002 08:11:37 -0000	1.13
@@ -107,7 +107,7 @@
         accesslog = log_open_file(stderr);
     }
         
-	log_set_level(errorlog, 4);
+	log_set_level(errorlog, config->loglevel);
         log_set_level(accesslog, 4);
 
         if (errorlog < 0)

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list