Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log thread_bus IPC messages only in debug mode #1800

Merged
merged 4 commits into from
Oct 17, 2022

Conversation

har7an
Copy link
Contributor

@har7an har7an commented Oct 16, 2022

Adds a new static global variable DEBUG_MODE, accessible via zellij_utils::consts. It is set when the server is spawned and depends on whether the server was started with the --debug flag. This is automatically the case when the first client starting a session is started with the --debug flag.

The variable is stored globally to make it easily accessible from within error-handling functions without having to carry the option everywhere. Since it is set by the server upon creation, it is only set exactly once: When the session is started for the first time. Hence, clients connecting to a session with the --debug flag cannot override the DEBUG_MODE value.

Logging of the Instructions sent in the zellij_server::thread_bus will only happen when the server is running in DEBUG_MODE. Otherwise, the error message is still shown as before, but the Instruction isn't included.

This is done in an attempt to reduce flooding the terminal and logs for long instructions. Also increases the logsize to 16 MiB per file to keep it from filling up very quickly when a large instruction is dumped there.

that tells us whether zellij was started with the `--debug` CLI flag.
mode, and discard the message otherwise.
per logfile, totaling 32 MiB of logs at most (in two files).
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.
@har7an har7an temporarily deployed to cachix October 16, 2022 18:36 Inactive
@har7an har7an merged commit f26e73c into zellij-org:main Oct 17, 2022
@har7an har7an deleted the feature/log-ipc-messages-when-debug branch October 17, 2022 15:34
har7an added a commit that referenced this pull request Oct 17, 2022
for logging of IPC messages in `thread_bus` only when the `--debug` flag is specified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant