summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2019-07-08 13:20:02 +0300
committerMarius Vlad <marius.vlad@collabora.com>2019-07-18 13:34:04 +0300
commite2d2ab7ed593a380088a77ce05595721d8354945 (patch)
tree13b0fcceaf97f208c39be51860f6b8afa5a73e7f
parent592555831a1759363851332de787cab020d12be1 (diff)
compositor: Remove from main displaying available log scopes
Place the subscribe parts and displaying of available scopes out of main as it makes no sense to keep them there. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--compositor/main.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/compositor/main.c b/compositor/main.c
index 2d9097f8..0fc53664 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -2936,6 +2936,27 @@ flight_rec_key_binding_handler(struct weston_keyboard *keyboard,
weston_log_subscriber_display_flight_rec(flight_rec);
}
+static void
+weston_log_subscribe_to_scopes(struct weston_log_context *log_ctx,
+ struct weston_log_subscriber *logger,
+ struct weston_log_subscriber *flight_rec,
+ const char *log_scopes,
+ const char *flight_rec_scopes)
+{
+ if (log_scopes)
+ weston_log_setup_scopes(log_ctx, logger, log_scopes);
+ else
+ weston_log_subscribe(log_ctx, logger, "log");
+
+ if (flight_rec_scopes) {
+ weston_log_setup_scopes(log_ctx, flight_rec, flight_rec_scopes);
+ } else {
+ /* by default subscribe to 'log', and 'drm-backend' */
+ weston_log_subscribe(log_ctx, flight_rec, "log");
+ weston_log_subscribe(log_ctx, flight_rec, "drm-backend");
+ }
+}
+
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
@@ -3028,19 +3049,10 @@ int main(int argc, char *argv[])
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");
-
flight_rec = weston_log_subscriber_create_flight_rec(DEFAULT_FLIGHT_REC_SIZE);
- if (flight_rec_scopes) {
- weston_log_setup_scopes(log_ctx, flight_rec, flight_rec_scopes);
- } else {
- /* subscribe to both 'log' and 'drm-backend' scope */
- weston_log_subscribe(log_ctx, flight_rec, "log");
- weston_log_subscribe(log_ctx, flight_rec, "drm-backend");
- }
+
+ weston_log_subscribe_to_scopes(log_ctx, logger, flight_rec,
+ log_scopes, flight_rec_scopes);
weston_log("%s\n"
STAMP_SPACE "%s\n"