diff options
author | har7an <99636919+har7an@users.noreply.github.com> | 2022-10-17 15:34:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 15:34:06 +0000 |
commit | f26e73ce03241cab89ee75aa1853973c21b22fc1 (patch) | |
tree | cc1535da82bfbfa44bee577ea4c58887f9dc4f70 /src | |
parent | 2ae057d061db2dc4d41afe39cb40197d3d01c616 (diff) |
Log `thread_bus` IPC messages only in debug mode (#1800)
* zellij: Add global `DEBUG_MODE` variable
that tells us whether zellij was started with the `--debug` CLI flag.
* utils/errors: Only log thread_bus message in debug
mode, and discard the message otherwise.
* utils/logging: Increase logsize to 16 MiB
per logfile, totaling 32 MiB of logs at most (in two files).
* zellij: Set global `DEBUG` variable in server
thread and make sure the value of the `--debug` CLI flag is propagated
to the server, too.
This means that to enable debug mode, the server must be started with
the `--debug` flag. This happens when the first client that starts the
zellij session has the `--debug` flag set, because it will be forwarded
to the server. Subsequent clients attaching to the same session with the
`--debug` flag specified **do not** override the value of the `DEBUG`
variable. Hence, if the server wasn't started in debug mode, this cannot
be changed.
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/commands.rs b/src/commands.rs index 1acaf12f4..e9ab951bc 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -86,7 +86,9 @@ fn get_os_input<OsInputOutput>( } } -pub(crate) fn start_server(path: PathBuf) { +pub(crate) fn start_server(path: PathBuf, debug: bool) { + // Set instance-wide debug mode + zellij_utils::consts::DEBUG_MODE.set(debug).unwrap(); let os_input = get_os_input(get_server_os_input); start_server_impl(Box::new(os_input), path); } diff --git a/src/main.rs b/src/main.rs index 895bc8998..fa18f0900 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,7 +74,7 @@ fn main() { { commands::kill_session(target_session); } else if let Some(path) = opts.server { - commands::start_server(path); + commands::start_server(path, opts.debug); } else { commands::start_client(opts); } |