diff logging.c @ 229:28a56e4c06a4

Improvements to log file handling
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 27 Oct 2014 17:48:22 +0100
parents 111610d871af
children ec81395bf08d
line wrap: on
line diff
--- a/logging.c	Thu Oct 09 15:58:32 2014 +0200
+++ b/logging.c	Mon Oct 27 17:48:22 2014 +0100
@@ -1,6 +1,7 @@
 #include <ansi_c.h>
 #include <inifile.h>
 #include <lowlvlio.h>
+#include <ansi_c.h>
 
 #include "config.h"
 #include "logging.h"
@@ -33,8 +34,12 @@
 
 	/* logging file name */
 	rv = Ini_GetStringCopy(configuration, "logging", "filename", &filename);
-	if (rv > 0)
+	if (rv > 0) {
+		__logmessage(l, INFO, "logging to '%s'", filename);
 		l->fd = open(filename, O_CREAT|O_WRONLY|O_APPEND, 00744);
+		if (l->fd < 0)
+			__logmessage(l, ERROR, "open log file %s: %s", filename, strerror(errno));
+	}
 		
 	free(filename);
 	Ini_Dispose(configuration);