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>
This commit is contained in:
Marius Vlad 2019-07-03 12:41:47 +03:00
parent 284d5345ad
commit b599ad7701
1 changed files with 6 additions and 5 deletions

View File

@ -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",