[PATCH 2/3] Weston: compositor.c: Logging to $HOME/weston.log, stderr

Martin Minarik minarik11 at student.fiit.stuba.sk
Sat May 26 08:40:56 PDT 2012


Signed-off-by: Martin Minarik <minarik11 at student.fiit.stuba.sk>
---
 src/compositor.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 3c1e058..6582e21 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -25,13 +25,13 @@
 #define _GNU_SOURCE
 
 #include "config.h"
+#include "log.h"
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <limits.h>
-#include <stdarg.h>
 #include <assert.h>
 #include <sys/ioctl.h>
 #include <sys/wait.h>
@@ -2845,6 +2845,14 @@ int main(int argc, char *argv[])
 		{ WESTON_OPTION_STRING, "module", 0, &module },
 	};
 
+	if (getenv("HOME")) {
+		char * logfname = "/weston.log";
+		char * home = getenv("HOME");
+		char string[128];
+		snprintf(string, 126, "%s%s", home,logfname);
+		weston_log_file_create(string);
+	}
+
 	memset(&xkb_names, 0, sizeof(xkb_names));
 
 	argc = parse_options(core_options,
@@ -2953,6 +2960,7 @@ int main(int argc, char *argv[])
 
 	ec->destroy(ec);
 	wl_display_destroy(display);
+	weston_log_file_destroy();
 
 	return 0;
 }
-- 
1.7.5.4



More information about the wayland-devel mailing list