OSSP CVS Repository

ossp - Check-in [2426]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2426
Date: 2002-Jul-30 12:08:08 (local)
2002-Jul-30 10:08:08 (UTC)
User:thl
Branch:
Comment: fprintf to stdout only if ERROR or worse
Tickets:
Inspections:
Files:
ossp-pkg/fsl/fsl.c      1.37 -> 1.38     7 inserted, 2 deleted

ossp-pkg/fsl/fsl.c 1.37 -> 1.38

--- fsl.c        2002/07/29 15:08:21     1.37
+++ fsl.c        2002/07/30 10:08:08     1.38
@@ -197,12 +197,17 @@
 static void fsldebug(l2_level_t level, const char *message, ...)
 {
     va_list ap;
+    char cp[8];
 
     va_start(ap, message);
     if (ctx.l2_fslnch != NULL)
         l2_channel_vlog(ctx.l2_fslnch, level, message, ap);
     else
-        vfprintf(stderr, message, ap);
+        if (level & L2_LEVEL_UPTO(L2_LEVEL_ERROR)) {
+            fprintf( stderr, "%s: ", l2_util_l2s(cp, sizeof(cp), '\0', level) == L2_OK ? cp[0]&=0xDF, cp : "Log");
+            vfprintf(stderr, message, ap);
+            fprintf( stderr, "\n");
+    }
     va_end(ap);
     return;
 }
@@ -746,7 +751,7 @@
 
     /* read configuration file(s) into buffer */
     if ((rv = readfileorallfiles(&buf, ident)) != FSL_OK) {
-        fsldebug(L2_LEVEL_ERROR, "openlog: readfileorallfiles(buf, \"%s\") returned %d, system error: %s(%d)", ident, rv, strerror(errno), errno); CU(1); }
+        fsldebug(L2_LEVEL_ERROR, "openlog: readfileorallfiles() for ident \"%s\" failed. Hint: last system error was \"%s\"(%d)", ident, strerror(errno), errno); CU(1); }
 
     /* import configuration buffer into OSSP cfg node tree */
     if ((cfgrv = cfg_create(&cfg)) != CFG_OK) {

CVSTrac 2.0.1