Add HL_DEBUG_CODEGEN_LOG_FILE to redirect debug() logs - #9361
Add HL_DEBUG_CODEGEN_LOG_FILE to redirect debug() logs#9361alexreinking wants to merge 3 commits into
Conversation
Applies globally, resolved at first debug() invocation. Maintains its own buffer so that it can send a whole chain of << outputs to the OS file descriptor in one atomic write. As long as the output buffer isn't exhausted, it is robust to parallel appends to files.
|
Funny. I wrote this with Claude, but I guess I steered it so much, it didn't want to credit itself 😂 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9361 +/- ##
==========================================
- Coverage 69.97% 69.95% -0.03%
==========================================
Files 259 259
Lines 79158 79201 +43
Branches 19293 19301 +8
==========================================
+ Hits 55394 55407 +13
- Misses 17898 17931 +33
+ Partials 5866 5863 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Curious why you want this. I'm afraid this is limitedly useful when debugging tests: the tests use regular When I first saw the title of this PR, I guessed you were increasing the log level for the log file by one over the console log. But it's equal it seems. |
It's not for debugging tests. It's for collecting data. We have hundreds to thousands of generator configurations and we want to get internal compiler debug prints out of them. Take for example, Lines 448 to 503 in e627fbe If I want to get all of the failed proofs out of a long build process, I can just write: $ export HL_DEBUG_CODEGEN="1,Simplify.cpp:448"
$ export HL_DEBUG_CODEGEN_LOG_FILE="$PWD/failed-proofs.log"
$ ./build-script.shWhere |
Applies globally, resolved at first debug() invocation. Maintains its own buffer so that it can send a whole chain of << outputs to the OS file descriptor in one atomic write. As long as the output buffer isn't exhausted, it is robust to parallel appends to files.
Remaps
/dev/stdouttostd::coutand/dev/stderrtostd::cerron all platforms (including Windows) both for compatibility and for less surprise when mixingstd::cerranddebug(0).Checklist