changeset 229:28a56e4c06a4

Improvements to log file handling
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 27 Oct 2014 17:48:22 +0100
parents 5e69d9abbbf2
children 9e240adb3053
files logging.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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);