[xiph-commits] r9758 - icecast/trunk/icecast/src

karl at svn.xiph.org karl at svn.xiph.org
Tue Aug 16 09:56:27 PDT 2005


Author: karl
Date: 2005-08-16 09:56:24 -0700 (Tue, 16 Aug 2005)
New Revision: 9758

Modified:
   icecast/trunk/icecast/src/event.c
   icecast/trunk/icecast/src/logging.c
   icecast/trunk/icecast/src/logging.h
   icecast/trunk/icecast/src/xslt.c
Log:
log xml/xslt parsing failure messages via error log. This applies to both the
xsl files and the icecast xml file when re-read. At icecast startup, the logs
are not open so these parsing messages still go to stderr.


Modified: icecast/trunk/icecast/src/event.c
===================================================================
--- icecast/trunk/icecast/src/event.c	2005-08-16 14:58:33 UTC (rev 9757)
+++ icecast/trunk/icecast/src/event.c	2005-08-16 16:56:24 UTC (rev 9758)
@@ -35,6 +35,7 @@
 
     config = config_grab_config(); /* Both to get the lock, and to be able
                                      to find out the config filename */
+    xmlSetGenericErrorFunc ("config", log_parse_failure);
     ret = config_parse_file(config->config_filename, &new_config);
     if(ret < 0) {
         ERROR0("Error parsing config, not replacing existing config");

Modified: icecast/trunk/icecast/src/logging.c
===================================================================
--- icecast/trunk/icecast/src/logging.c	2005-08-16 14:58:33 UTC (rev 9757)
+++ icecast/trunk/icecast/src/logging.c	2005-08-16 16:56:24 UTC (rev 9758)
@@ -188,7 +188,21 @@
 }
 
 
+void log_parse_failure (void *ctx, const char *fmt, ...)
+{
+    char line [200];
+    va_list ap;
+    char *eol;
 
+    va_start (ap, fmt);
+    vsnprintf (line, sizeof (line), fmt, ap);
+    eol = strrchr (line, '\n');
+    if (eol) *eol='\0';
+    va_end (ap);
+    log_write (errorlog, 2, (char*)ctx, "", "%s", line);
+}
+
+
 void restart_logging (ice_config_t *config)
 {
     if (strcmp (config->error_log, "-"))

Modified: icecast/trunk/icecast/src/logging.h
===================================================================
--- icecast/trunk/icecast/src/logging.h	2005-08-16 14:58:33 UTC (rev 9757)
+++ icecast/trunk/icecast/src/logging.h	2005-08-16 16:56:24 UTC (rev 9758)
@@ -95,6 +95,7 @@
 void logging_access(client_t *client);
 void logging_playlist(const char *mount, const char *metadata, long listeners);
 void restart_logging (ice_config_t *config);
+void log_parse_failure (void *ctx, const char *fmt, ...);
 
 #endif  /* __LOGGING_H__ */
 

Modified: icecast/trunk/icecast/src/xslt.c
===================================================================
--- icecast/trunk/icecast/src/xslt.c	2005-08-16 14:58:33 UTC (rev 9757)
+++ icecast/trunk/icecast/src/xslt.c	2005-08-16 16:56:24 UTC (rev 9758)
@@ -190,6 +190,9 @@
     xmlChar *string;
     int len, problem = 0;
 
+    xmlSetGenericErrorFunc ("", log_parse_failure);
+    xsltSetGenericErrorFunc ("", log_parse_failure);
+
     thread_mutex_lock(&xsltlock);
     cur = xslt_get_stylesheet(xslfilename);
 



More information about the commits mailing list