Implement debuglog command
Add debuglog command that takes toggle|on|off. Add get_debug_logging() to be able to toggle. Make t/187-commands-parser.t expect 'debuglog'. Document the debuglog command in userguide.
This commit is contained in:
parent
6241419c86
commit
023594909e
|
@ -1762,6 +1762,8 @@ stack-limit rows 5
|
|||
image:stacklimit.png[Container limited to two columns]
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[shmlog]]
|
||||
|
||||
=== Enabling shared memory logging
|
||||
|
||||
As described in http://i3wm.org/docs/debugging.html, i3 can log to a shared
|
||||
|
@ -1787,6 +1789,24 @@ bindsym $mod+x shmlog toggle
|
|||
i3-msg shmlog $((50*1024*1024))
|
||||
---------------
|
||||
|
||||
=== Enabling debug logging
|
||||
|
||||
The +debuglog+ command allows you to enable or disable debug logging at
|
||||
runtime. Debug logging is much more verbose than non-debug logging. This
|
||||
command does not activate shared memory logging (shmlog), and as such is most
|
||||
likely useful in combination with the above-described <<shmlog>> command.
|
||||
|
||||
*Syntax*:
|
||||
------------------------
|
||||
debuglog <on|off|toggle>
|
||||
------------------------
|
||||
|
||||
*Examples*:
|
||||
------------
|
||||
# Enable/disable logging
|
||||
bindsym $mod+x debuglog toggle
|
||||
------------
|
||||
|
||||
=== Reloading/Restarting/Exiting
|
||||
|
||||
You can make i3 reload its configuration file with +reload+. You can also
|
||||
|
|
|
@ -277,4 +277,10 @@ void cmd_bar(I3_CMD, char *bar_type, char *bar_value, char *bar_id);
|
|||
*/
|
||||
void cmd_shmlog(I3_CMD, char *argument);
|
||||
|
||||
/*
|
||||
* Implementation of 'debuglog toggle|on|off'
|
||||
*
|
||||
*/
|
||||
void cmd_debuglog(I3_CMD, char *argument);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,6 +50,12 @@ void open_logbuffer(void);
|
|||
*/
|
||||
void close_logbuffer(void);
|
||||
|
||||
/**
|
||||
* Checks if debug logging is active.
|
||||
*
|
||||
*/
|
||||
bool get_debug_logging(void);
|
||||
|
||||
/**
|
||||
* Set debug logging.
|
||||
*
|
||||
|
|
|
@ -20,6 +20,7 @@ state INITIAL:
|
|||
'restart' -> call cmd_restart()
|
||||
'reload' -> call cmd_reload()
|
||||
'shmlog' -> SHMLOG
|
||||
'debuglog' -> DEBUGLOG
|
||||
'border' -> BORDER
|
||||
'layout' -> LAYOUT
|
||||
'append_layout' -> APPEND_LAYOUT
|
||||
|
@ -69,6 +70,11 @@ state SHMLOG:
|
|||
argument = string
|
||||
-> call cmd_shmlog($argument)
|
||||
|
||||
# debuglog toggle|on|off
|
||||
state DEBUGLOG:
|
||||
argument = 'toggle', 'on', 'off'
|
||||
-> call cmd_debuglog($argument)
|
||||
|
||||
# border normal|none|1pixel|toggle|1pixel
|
||||
state BORDER:
|
||||
border_style = 'normal', 'pixel'
|
||||
|
|
|
@ -2059,3 +2059,23 @@ void cmd_shmlog(I3_CMD, char *argument) {
|
|||
// XXX: default reply for now, make this a better reply
|
||||
ysuccess(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of 'debuglog toggle|on|off'
|
||||
*
|
||||
*/
|
||||
void cmd_debuglog(I3_CMD, char *argument) {
|
||||
bool logging = get_debug_logging();
|
||||
if (!strcmp(argument,"toggle")) {
|
||||
LOG("%s debug logging\n", logging ? "Disabling" : "Enabling");
|
||||
set_debug_logging(!logging);
|
||||
} else if (!strcmp(argument, "on") && !logging) {
|
||||
LOG("Enabling debug logging\n");
|
||||
set_debug_logging(true);
|
||||
} else if (!strcmp(argument, "off") && logging) {
|
||||
LOG("Disabling debug logging\n");
|
||||
set_debug_logging(false);
|
||||
}
|
||||
// XXX: default reply for now, make this a better reply
|
||||
ysuccess(true);
|
||||
}
|
||||
|
|
|
@ -180,6 +180,14 @@ void set_verbosity(bool _verbose) {
|
|||
verbose = _verbose;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get debug logging.
|
||||
*
|
||||
*/
|
||||
bool get_debug_logging(void) {
|
||||
return debug_logging;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set debug logging.
|
||||
*
|
||||
|
|
|
@ -144,7 +144,7 @@ is(parser_calls("\nworkspace test"),
|
|||
################################################################################
|
||||
|
||||
is(parser_calls('unknown_literal'),
|
||||
"ERROR: Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'shmlog', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'resize', 'rename', 'nop', 'scratchpad', 'mode', 'bar'\n" .
|
||||
"ERROR: Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'shmlog', 'debuglog', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'resize', 'rename', 'nop', 'scratchpad', 'mode', 'bar'\n" .
|
||||
"ERROR: Your command: unknown_literal\n" .
|
||||
"ERROR: ^^^^^^^^^^^^^^^",
|
||||
'error for unknown literal ok');
|
||||
|
|
Loading…
Reference in New Issue