diff options
Diffstat (limited to 'sway/old/commands/debuglog.c')
-rw-r--r-- | sway/old/commands/debuglog.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sway/old/commands/debuglog.c b/sway/old/commands/debuglog.c new file mode 100644 index 00000000..658d6165 --- /dev/null +++ b/sway/old/commands/debuglog.c | |||
@@ -0,0 +1,27 @@ | |||
1 | #include <string.h> | ||
2 | #include <strings.h> | ||
3 | #include "sway/commands.h" | ||
4 | #include "log.h" | ||
5 | |||
6 | struct cmd_results *cmd_debuglog(int argc, char **argv) { | ||
7 | struct cmd_results *error = NULL; | ||
8 | if ((error = checkarg(argc, "debuglog", EXPECTED_EQUAL_TO, 1))) { | ||
9 | return error; | ||
10 | } else if (strcasecmp(argv[0], "toggle") == 0) { | ||
11 | if (config->reading) { | ||
12 | return cmd_results_new(CMD_FAILURE, "debuglog toggle", "Can't be used in config file."); | ||
13 | } | ||
14 | if (toggle_debug_logging()) { | ||
15 | sway_log(L_DEBUG, "Debuglog turned on."); | ||
16 | } | ||
17 | } else if (strcasecmp(argv[0], "on") == 0) { | ||
18 | set_log_level(L_DEBUG); | ||
19 | sway_log(L_DEBUG, "Debuglog turned on."); | ||
20 | } else if (strcasecmp(argv[0], "off") == 0) { | ||
21 | reset_log_level(); | ||
22 | } else { | ||
23 | return cmd_results_new(CMD_FAILURE, "debuglog", "Expected 'debuglog on|off|toggle'"); | ||
24 | } | ||
25 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
26 | } | ||
27 | |||