diff options
author | crondog <crondog@gmail.com> | 2016-01-04 11:22:20 +1100 |
---|---|---|
committer | crondog <crondog@gmail.com> | 2016-01-04 11:22:20 +1100 |
commit | 7f7e06d4c908f9cc4d075f723744a1570bc1cfc6 (patch) | |
tree | f23181b28d497236296acd4606e945e31a279374 /swaybar | |
parent | Merge pull request #429 from mikkeloscar/bar-workspace-buttons (diff) | |
download | sway-7f7e06d4c908f9cc4d075f723744a1570bc1cfc6.tar.gz sway-7f7e06d4c908f9cc4d075f723744a1570bc1cfc6.tar.zst sway-7f7e06d4c908f9cc4d075f723744a1570bc1cfc6.zip |
swaybar: fix logging
Optionally turn on debugging in swaybar. I acidentally introduced
persistent logging in a previous commit
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index e96c9df0..e3967846 100644 --- a/swaybar/main.c +++ b/swaybar/main.c | |||
@@ -744,7 +744,7 @@ void free_status_block(void *item) { | |||
744 | void parse_json(const char *text) { | 744 | void parse_json(const char *text) { |
745 | json_object *results = json_tokener_parse(text); | 745 | json_object *results = json_tokener_parse(text); |
746 | if (!results) { | 746 | if (!results) { |
747 | sway_log(L_DEBUG, "xxx Failed to parse json"); | 747 | sway_log(L_DEBUG, "Failed to parse json"); |
748 | return; | 748 | return; |
749 | } | 749 | } |
750 | 750 | ||
@@ -1185,22 +1185,23 @@ void poll_for_update() { | |||
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | int main(int argc, char **argv) { | 1187 | int main(int argc, char **argv) { |
1188 | init_log(L_DEBUG); | ||
1189 | 1188 | ||
1190 | char *socket_path = NULL; | 1189 | char *socket_path = NULL; |
1191 | char *bar_id = NULL; | 1190 | char *bar_id = NULL; |
1191 | bool debug = false; | ||
1192 | 1192 | ||
1193 | static struct option long_options[] = { | 1193 | static struct option long_options[] = { |
1194 | {"version", no_argument, NULL, 'v'}, | 1194 | {"version", no_argument, NULL, 'v'}, |
1195 | {"socket", required_argument, NULL, 's'}, | 1195 | {"socket", required_argument, NULL, 's'}, |
1196 | {"bar_id", required_argument, NULL, 'b'}, | 1196 | {"bar_id", required_argument, NULL, 'b'}, |
1197 | {"debug", required_argument, NULL, 'd'}, | ||
1197 | {0, 0, 0, 0} | 1198 | {0, 0, 0, 0} |
1198 | }; | 1199 | }; |
1199 | 1200 | ||
1200 | int c; | 1201 | int c; |
1201 | while (1) { | 1202 | while (1) { |
1202 | int option_index = 0; | 1203 | int option_index = 0; |
1203 | c = getopt_long(argc, argv, "vs:b:", long_options, &option_index); | 1204 | c = getopt_long(argc, argv, "vs:b:d", long_options, &option_index); |
1204 | if (c == -1) { | 1205 | if (c == -1) { |
1205 | break; | 1206 | break; |
1206 | } | 1207 | } |
@@ -1219,6 +1220,9 @@ int main(int argc, char **argv) { | |||
1219 | #endif | 1220 | #endif |
1220 | exit(EXIT_SUCCESS); | 1221 | exit(EXIT_SUCCESS); |
1221 | break; | 1222 | break; |
1223 | case 'd': // Debug | ||
1224 | debug = true; | ||
1225 | break; | ||
1222 | default: | 1226 | default: |
1223 | exit(EXIT_FAILURE); | 1227 | exit(EXIT_FAILURE); |
1224 | } | 1228 | } |
@@ -1227,6 +1231,12 @@ int main(int argc, char **argv) { | |||
1227 | if (!bar_id) { | 1231 | if (!bar_id) { |
1228 | sway_abort("No bar_id passed. Provide --bar_id or let sway start swaybar"); | 1232 | sway_abort("No bar_id passed. Provide --bar_id or let sway start swaybar"); |
1229 | } | 1233 | } |
1234 | |||
1235 | if (debug) { | ||
1236 | init_log(L_DEBUG); | ||
1237 | } else { | ||
1238 | init_log(L_ERROR); | ||
1239 | } | ||
1230 | 1240 | ||
1231 | registry = registry_poll(); | 1241 | registry = registry_poll(); |
1232 | 1242 | ||