aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/errors.rs
diff options
context:
space:
mode:
authorhar7an <99636919+har7an@users.noreply.github.com>2022-10-17 15:34:06 +0000
committerGitHub <noreply@github.com>2022-10-17 15:34:06 +0000
commitf26e73ce03241cab89ee75aa1853973c21b22fc1 (patch)
treecc1535da82bfbfa44bee577ea4c58887f9dc4f70 /zellij-utils/src/errors.rs
parentdocs(changelog): edit panes in layouts (diff)
downloadsl0ppij-f26e73ce03241cab89ee75aa1853973c21b22fc1.tar.gz
sl0ppij-f26e73ce03241cab89ee75aa1853973c21b22fc1.tar.xz
sl0ppij-f26e73ce03241cab89ee75aa1853973c21b22fc1.zip
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 'zellij-utils/src/errors.rs')
-rw-r--r--zellij-utils/src/errors.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 5c872741..a662ed24 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -547,10 +547,15 @@ mod not_wasm {
Ok(val) => crate::anyhow::Ok(val),
Err(e) => {
let (msg, context) = e.into_inner();
- Err(
- crate::anyhow::anyhow!("failed to send message to channel: {:#?}", msg)
- .context(context.to_string()),
- )
+ if *crate::consts::DEBUG_MODE.get().unwrap_or(&true) {
+ Err(
+ crate::anyhow::anyhow!("failed to send message to channel: {:#?}", msg)
+ .context(context.to_string()),
+ )
+ } else {
+ Err(crate::anyhow::anyhow!("failed to send message to channel")
+ .context(context.to_string()))
+ }
},
}
}