poldek: poldek/log.c - playing with auto-endlining

mis mis at pld-linux.org
Fri Jul 6 01:19:36 CEST 2007


Author: mis                          Date: Thu Jul  5 23:19:36 2007 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- playing with auto-endlining

---- Files affected:
poldek/poldek:
   log.c (1.32 -> 1.33) 

---- Diffs:

================================================================
Index: poldek/poldek/log.c
diff -u poldek/poldek/log.c:1.32 poldek/poldek/log.c:1.33
--- poldek/poldek/log.c:1.32	Mon Jul  2 19:08:38 2007
+++ poldek/poldek/log.c	Fri Jul  6 01:19:31 2007
@@ -173,7 +173,6 @@
     /* auto line break for errors and warnings */
     if (!last_endlined && !is_continuation && (pri & (LOGERR|LOGWARN))) {
         buf[buf_len++] = '\n';
-        n_assert(0);
     }
     
     last_endlined = is_endlined;
@@ -273,9 +272,18 @@
 
 static void do_log(unsigned flags, int pri, const char *fmt, va_list args) 
 {
+    char *endl = NULL;
     int i;
+
+    if (*fmt == '\n' && (pri & (LOGERR|LOGWARN|LOGNOTICE))) {
+        fmt++;
+        endl = "\n";
+    }
     
     if (log_appenders == NULL || n_array_size(log_appenders) == 0) {
+        if (endl)
+            vlog_tty(NULL, LOGOPT_CONT, endl, NULL);
+            
         vlog_tty(NULL, pri, fmt, args);
         return;
     }
@@ -285,8 +293,10 @@
 
         if ((ape->flags & flags) == 0)
             continue;
-
+        
         if (ape->dolog) {
+            if (endl)
+                ape->dolog(ape->_data, LOGOPT_CONT, endl, NULL);
             ape->dolog(ape->_data, pri, fmt, args);
         
         } else {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/log.c?r1=1.32&r2=1.33&f=u



More information about the pld-cvs-commit mailing list