From 024c2f7e6b11c6e0d9e6a80a6ba355d2f340bbf4 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 9 Dec 2019 21:53:38 +0100 Subject: [PATCH] Configure log priority early The log priority must be configured before parsing command-line arguments, in order to get logs as expected. --- app/src/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main.c b/app/src/main.c index 43e2cc04..d683c508 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -37,6 +37,11 @@ main(int argc, char *argv[]) { setbuf(stdout, NULL); setbuf(stderr, NULL); #endif + +#ifndef NDEBUG + SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG); +#endif + struct scrcpy_cli_args args = { .opts = SCRCPY_OPTIONS_DEFAULT, .help = false, @@ -67,10 +72,6 @@ main(int argc, char *argv[]) { return 1; } -#ifndef NDEBUG - SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG); -#endif - int res = scrcpy(&args.opts) ? 0 : 1; avformat_network_deinit(); // ignore failure