chiark / gitweb /
A couple of stray disorder_error/_fatal fixes
[disorder] / lib / log.c
index 95a89a1b872f7df90616cd7c2ee18694434920c6..82ba3772066e4ca6bfd437b89cfd114c658e4278 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
  */
 /** @file lib/log.c @brief Errors and logging
  *
- * All messages are initially emitted by one of the four functions below.
- * debug() is generally invoked via D() so that mostly you just do a test
- * rather than a complete subroutine call.
+ * All messages are initially emitted by one of the four functions
+ * below.  disorder_debug() is generally invoked via D() so that
+ * mostly you just do a test rather than a complete subroutine call.
  *
  * Messages are dispatched via @ref log_default.  This defaults to @ref
  * log_stderr.  daemonize() will turn off @ref log_stderr and use @ref
  * log_syslog instead.
  *
- * fatal() will call exitfn() with a nonzero status.  The default value is
- * exit(), but it should be set to _exit() anywhere but the 'main line' of the
- * program, to guarantee that exit() gets called at most once.
+ * disorder_fatal() will call exitfn() with a nonzero status.  The
+ * default value is exit(), but it should be set to _exit() anywhere
+ * but the 'main line' of the program, to guarantee that exit() gets
+ * called at most once.
  */
 
 #define NO_MEMORY_ALLOCATION
@@ -123,8 +124,6 @@ static void logfp(int pri, const char *msg, void *user) {
    * sanely */
   const char *p;
   
-  if(progname)
-    fprintf(fp, "%s: ", progname);
   if(logdate) {
     char timebuf[64];
     struct tm *tm;
@@ -132,7 +131,9 @@ static void logfp(int pri, const char *msg, void *user) {
     tm = localtime(&tv.tv_sec);
     strftime(timebuf, sizeof timebuf, "%Y-%m-%d %H:%M:%S %Z", tm);
     fprintf(fp, "%s: ", timebuf);
-  }
+  } 
+ if(progname)
+    fprintf(fp, "%s: ", progname);
   if(pri <= LOG_ERR)
     fputs("ERROR: ", fp);
   else if(pri < LOG_DEBUG)