summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2019-07-03 12:41:47 +0300
committerMarius Vlad <marius.vlad@collabora.com>2019-07-18 13:34:04 +0300
commitb599ad7701a1e27fa2cce84d7148cd3234957c81 (patch)
tree2ac18bd0f7314485a48f04f39807f8a20e054cc2
parent284d5345ad38dfd0e4ee08d3da75ace0a512a2c4 (diff)
downloadweston-b599ad7701a1e27fa2cce84d7148cd3234957c81.tar.gz
compositor: Create the 'log' scope much earlier
Logging should start as early as possible so create the log scope as early as possible, before subscribing to it. Open the logfile before creating the 'logger' subscriber, making sure we're logging to the file properly. Also migrate `weston_log_set_handler()` to avoid potential calls to `weston_log` before installing the log handler. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--compositor/main.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/compositor/main.c b/compositor/main.c
index 068d0bf7..be5cfea8 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -3004,15 +3004,18 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+ log_scope = weston_compositor_add_log_scope(log_ctx, "log",
+ "Weston and Wayland log\n", NULL, NULL);
+
+ weston_log_file_open(log);
+ weston_log_set_handler(vlog, vlog_continue);
+
logger = weston_log_subscriber_create_log(weston_logfile);
if (log_scopes)
weston_log_setup_scopes(log_ctx, logger, log_scopes);
else
weston_log_subscribe(log_ctx, logger, "log");
- weston_log_set_handler(vlog, vlog_continue);
- weston_log_file_open(log);
-
weston_log("%s\n"
STAMP_SPACE "%s\n"
STAMP_SPACE "Bug reports to: %s\n"
@@ -3085,8 +3088,6 @@ int main(int argc, char *argv[])
}
segv_compositor = wet.compositor;
- log_scope = weston_compositor_add_log_scope(log_ctx, "log",
- "Weston and Wayland log\n", NULL, NULL);
protocol_scope =
weston_compositor_add_log_scope(log_ctx,
"proto",