Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

log on watchdog activation

Open bvngee opened this issue 1 year ago • 5 comments

Describe your PR, what does it fix/add?

When watchdog is triggered, log something so that users that are debugging / working on Hyprland don't get confused when a simple breakpoint crashes their program. Context: this discord message.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Thinking about the new user experience, debug:enable_stdout_logs is still disabled by default, meaning this won't take effect unless users have already looked through all the debugging variables and happened to set this. Maybe it makes sense to set the default value of disable_logs/enable_stdout_logs based on whether it's a debug build or not?

Is it ready for merging, or does it need work?

Should be ready, though feel free to reword the message

bvngee avatar Apr 29 '24 07:04 bvngee

but it is logged: https://github.com/hyprwm/Hyprland/blob/33e0bb14786dc22a0c82eaaf097b469d3fdeceea/src/helpers/WLListener.cpp#L13-L17

vaxerski avatar Apr 29 '24 13:04 vaxerski

but it is logged: https://github.com/hyprwm/Hyprland/blob/33e0bb14786dc22a0c82eaaf097b469d3fdeceea/src/helpers/WLListener.cpp#L13-L17

Hmm, that didn't seem to trigger for me to while debugging Hyprland with breakpoints. I didn't even notice that was there.

bvngee avatar Apr 29 '24 13:04 bvngee

generally we can't log from watchdog because Debug::log is not thread-safe

vaxerski avatar Apr 29 '24 14:04 vaxerski

we can't log from watchdog because Debug::log is not thread-safe

Ah, I completely missed that. Well I'm not too sure then how to go about generic watchdog logging from the main thread (in a way that triggers when GDB pauses at a breakpoint). Feel free to close this as incorrect, though it's def still worth thinking about

bvngee avatar Apr 30 '24 01:04 bvngee

I mean generally on my end the log gets printed... You can try adding a std::chrono::this_thread::sleep_for(std::chrono::seconds(10)) in a random handler and seeing if the log is printed

vaxerski avatar Apr 30 '24 01:04 vaxerski

I mean generally on my end the log gets printed... You can try adding a std::chrono::this_thread::sleep_for(std::chrono::seconds(10)) in a random handler and seeing if the log is printed

Turns out I just had to set disable_logs to false. This surprises me though, given that its description on the wiki says it "disables logging to a file" but it also apparently disables watchdog logging to stdout (even though there's a dedicated enable_stdout_logs which I had set to true already). I can't quite figure out why this is the case (and don't rly have the time rn) but I think it's pretty weird that the watchdog log only occurs when disabled_logs is false and enable_stdout_logs is true. Either that or the wiki description is just outdated

bvngee avatar May 09 '24 23:05 bvngee