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>
dev
Marius Vlad 6 years ago
parent 284d5345ad
commit b599ad7701
  1. 11
      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",

Loading…
Cancel
Save