aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-29 14:56:33 +0100
committerS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-29 15:01:47 +0100
commitc26a4b42cf196af3f84c8cbdd63394d021f47217 (patch)
treef6cd62875a05a35c5c2d229ce53d500365b0f215
parent01c5349e1a792c40725a23d95c537419ee7cdb1a (diff)
main: Setup logging before wlc_init.
If `wlc_init` fails the error message will never be logged or printed anywhere.
-rw-r--r--sway/main.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sway/main.c b/sway/main.c
index dd609214..1a4087d3 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -107,6 +107,14 @@ int main(int argc, char **argv) {
}
}
+ // we need to setup logging before wlc_init in case it fails.
+ if (debug) {
+ init_log(L_DEBUG);
+ } else if (verbose || validate) {
+ init_log(L_INFO);
+ } else {
+ init_log(L_ERROR);
+ }
setenv("WLC_DIM", "0", 0);
wlc_log_set_handler(wlc_log_handler);
detect_nvidia();
@@ -119,14 +127,6 @@ int main(int argc, char **argv) {
}
register_extensions();
- if (debug) {
- init_log(L_DEBUG);
- } else if (verbose || validate) {
- init_log(L_INFO);
- } else {
- init_log(L_ERROR);
- }
-
#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
#endif