Replace broken debuglog command with log_level command.

This commit is contained in:
Geoff Greer 2019-02-15 13:45:37 -08:00
parent cdbf8e8b25
commit 9f504f07f3
5 changed files with 33 additions and 5 deletions

View file

@ -112,7 +112,6 @@ sway_cmd cmd_client_placeholder;
sway_cmd cmd_client_background;
sway_cmd cmd_commands;
sway_cmd cmd_create_output;
sway_cmd cmd_debuglog;
sway_cmd cmd_default_border;
sway_cmd cmd_default_floating_border;
sway_cmd cmd_default_orientation;
@ -142,6 +141,7 @@ sway_cmd cmd_ipc;
sway_cmd cmd_kill;
sway_cmd cmd_layout;
sway_cmd cmd_log_colors;
sway_cmd cmd_log_level;
sway_cmd cmd_mark;
sway_cmd cmd_mode;
sway_cmd cmd_mouse_warping;

View file

@ -74,6 +74,7 @@ static struct cmd_handler handlers[] = {
{ "hide_edge_borders", cmd_hide_edge_borders },
{ "include", cmd_include },
{ "input", cmd_input },
{ "log_level", cmd_log_level },
{ "mode", cmd_mode },
{ "mouse_warping", cmd_mouse_warping },
{ "new_float", cmd_default_floating_border },

27
sway/commands/log_level.c Normal file
View file

@ -0,0 +1,27 @@
#include <stdlib.h>
#include "sway/commands.h"
#include "log.h"
struct cmd_results *cmd_log_level(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "log_level", EXPECTED_EQUAL_TO, 1))) {
return error;
}
sway_log_importance_t verbosity;
if (strcmp(*argv, "debug") == 0) {
verbosity = SWAY_DEBUG;
} else if (strcmp(*argv, "info") == 0) {
verbosity = SWAY_INFO;
} else if (strcmp(*argv, "error") == 0) {
verbosity = SWAY_ERROR;
} else if (strcmp(*argv, "silent") == 0) {
verbosity = SWAY_SILENT;
} else {
return cmd_results_new(CMD_INVALID, "Invalid log_level option.");
}
sway_log_init(verbosity, NULL);
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -68,6 +68,7 @@ sway_sources = files(
'commands/include.c',
'commands/input.c',
'commands/layout.c',
'commands/log_level.c',
'commands/mode.c',
'commands/mouse_warping.c',
'commands/move.c',

View file

@ -413,10 +413,6 @@ The default colors are:
: #0c0c0c
*debuglog* on|off|toggle
Enables, disables or toggles debug logging. _toggle_ cannot be used in the
configuration file.
*default_border* normal|none|pixel [<n>]
Set default border style for new tiled windows.
@ -506,6 +502,9 @@ The default colors are:
devices. A list of input device names may be obtained via *swaymsg -t
get_inputs*.
*log_level* debug|info|error|silent
Sets the logging verbosity. Default is error.
*seat* <seat> <seat-subcommands...>
For details on seat subcommands, see *sway-input*(5).