diff options
author | 2015-11-29 14:56:33 +0100 | |
---|---|---|
committer | 2015-11-29 15:01:47 +0100 | |
commit | c26a4b42cf196af3f84c8cbdd63394d021f47217 (patch) | |
tree | f6cd62875a05a35c5c2d229ce53d500365b0f215 /sway/main.c | |
parent | Merge pull request #272 from mikkeloscar/output-cmd-warnings (diff) | |
download | sway-c26a4b42cf196af3f84c8cbdd63394d021f47217.tar.gz sway-c26a4b42cf196af3f84c8cbdd63394d021f47217.tar.zst sway-c26a4b42cf196af3f84c8cbdd63394d021f47217.zip |
main: Setup logging before wlc_init.
If `wlc_init` fails the error message will never be logged or printed
anywhere.
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 16 |
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) { | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | // we need to setup logging before wlc_init in case it fails. | ||
111 | if (debug) { | ||
112 | init_log(L_DEBUG); | ||
113 | } else if (verbose || validate) { | ||
114 | init_log(L_INFO); | ||
115 | } else { | ||
116 | init_log(L_ERROR); | ||
117 | } | ||
110 | setenv("WLC_DIM", "0", 0); | 118 | setenv("WLC_DIM", "0", 0); |
111 | wlc_log_set_handler(wlc_log_handler); | 119 | wlc_log_set_handler(wlc_log_handler); |
112 | detect_nvidia(); | 120 | detect_nvidia(); |
@@ -119,14 +127,6 @@ int main(int argc, char **argv) { | |||
119 | } | 127 | } |
120 | register_extensions(); | 128 | register_extensions(); |
121 | 129 | ||
122 | if (debug) { | ||
123 | init_log(L_DEBUG); | ||
124 | } else if (verbose || validate) { | ||
125 | init_log(L_INFO); | ||
126 | } else { | ||
127 | init_log(L_ERROR); | ||
128 | } | ||
129 | |||
130 | #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE | 130 | #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE |
131 | sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); | 131 | sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); |
132 | #endif | 132 | #endif |