Add logging functionality

This is logging functionality for weston compositor.

It handles:
messages coming from libwayland-server from wl_log()
messages from weston itself, from weston_log()

Introduce --log option, to specify log file path on the command line.
When the path is incorrect, or on weston_log_file_destroy(), fall
back to stderr.
diff --git a/src/compositor.c b/src/compositor.c
index 3b1ca1e..a6a05f6 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -48,6 +48,7 @@
 #include <wayland-server.h>
 #include "compositor.h"
 #include "../shared/os-compatibility.h"
+#include "log.h"
 
 static struct wl_list child_process_list;
 static jmp_buf segv_jmp_buf;
@@ -3105,6 +3106,7 @@
 	char *backend = NULL;
 	char *shell = NULL;
 	char *module = NULL;
+	char *log = NULL;
 	int32_t idle_time = 300;
 	int32_t xserver = 0;
 	char *socket_name = NULL;
@@ -3125,6 +3127,7 @@
 		{ WESTON_OPTION_INTEGER, "idle-time", 'i', &idle_time },
 		{ WESTON_OPTION_BOOLEAN, "xserver", 0, &xserver },
 		{ WESTON_OPTION_STRING, "module", 0, &module },
+		{ WESTON_OPTION_STRING, "log", 0, &log },
 	};
 
 	argc = parse_options(core_options,
@@ -3135,6 +3138,8 @@
 		exit(EXIT_FAILURE);
 	}
 
+	weston_log_file_open(log);
+
 	display = wl_display_create();
 
 	loop = wl_display_get_event_loop(display);
@@ -3237,5 +3242,7 @@
 	ec->destroy(ec);
 	wl_display_destroy(display);
 
+	weston_log_file_close();
+
 	return ret;
 }