From f30f52931585239b7cd9e4c9f4a70b2f88a8de30 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Mon, 1 Aug 2022 17:39:49 +0200 Subject: [PATCH 1/2] docs(contributing): document logging --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47437f1604..d6b1b58183 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,6 +83,13 @@ Once you do, in the repository root: To re-run the tests after you've changed something in the code base, be sure to repeat steps 2 and 3. +## Debugging / Troubleshooting while developing +Zellij uses the excellent [`log`](https://crates.io/crates/log) crate to handle its internal logging. The output of these logs will go to `/tmp/zellij-/zellij-log/zellij.log`. + +Note that the output is truncated at 100KB. This can be adjusted for the purposes of debugging through the `LOG_MAX_BYTES` constant, at the time of writing here: https://github.com/zellij-org/zellij/blob/main/zellij-utils/src/logging.rs#L24 + +When running Zellij with the `--debug` flag, Zellij will dump a copy of all bytes received over the pty for each pane in: `/tmp/zellij-/zellij-log/zellij-.log`. These might be useful when troubleshooting terminal issues. + ## How we treat clippy lints We currently use clippy in [GitHub Actions](https://github.com/zellij-org/zellij/blob/main/.github/workflows/rust.yml) with the default settings that report only [`clippy::correctness`](https://github.com/rust-lang/rust-clippy#readme) as errors and other lints as warnings because Zellij is still unstable. This means that all warnings can be ignored depending on the situation at that time, even though they are also helpful to keep the code quality. From 0822a8470f8c7d52fef303ebbb8d3afdb7daeb34 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Mon, 1 Aug 2022 17:42:49 +0200 Subject: [PATCH 2/2] docs(contributing): add logging example --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6b1b58183..0f62b09efb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,6 +86,12 @@ To re-run the tests after you've changed something in the code base, be sure to ## Debugging / Troubleshooting while developing Zellij uses the excellent [`log`](https://crates.io/crates/log) crate to handle its internal logging. The output of these logs will go to `/tmp/zellij-/zellij-log/zellij.log`. +Example: +```rust +let my_variable = some_function(); +log::info!("my variable is: {:?}", my_variable); +``` + Note that the output is truncated at 100KB. This can be adjusted for the purposes of debugging through the `LOG_MAX_BYTES` constant, at the time of writing here: https://github.com/zellij-org/zellij/blob/main/zellij-utils/src/logging.rs#L24 When running Zellij with the `--debug` flag, Zellij will dump a copy of all bytes received over the pty for each pane in: `/tmp/zellij-/zellij-log/zellij-.log`. These might be useful when troubleshooting terminal issues.