util/log: don't print full source path to stderr#8893
util/log: don't print full source path to stderr#8893ripatel-fd wants to merge 1 commit intofiredancer-io:mainfrom
Conversation
5f09db7 to
57cdb04
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates Firedancer’s logging pipeline so stderr logs show only the source file basename (e.g., fd_metrics.c) rather than the full build-time source path, while keeping the full path available for the logfile output.
Changes:
- Introduce
FD_SRC_FILEto compute a basename for__FILE__(using__FILE_NAME__when available). - Extend
fd_log_private_1/fd_log_private_2to accept bothpathandfile_name, and switch stderr formatting to usefile_name. - Update a few local “NOEXIT” logging macros to pass the new
file_nameargument.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/util/log/fd_log.h |
Adds FD_SRC_FILE, updates log macros and private logger prototypes to pass both path and basename. |
src/util/log/fd_log.c |
Implements updated fd_log_private_{1,2} signatures and prints basename to stderr while preserving full path in logfile. |
src/disco/keyguard/fd_keyguard_proofs.c |
Updates CBMC stub prototypes for the new logger function signatures. |
src/app/shared_dev/commands/dev.c |
Updates local FD_LOG_ERR_NOEXIT macro to pass basename argument. |
src/app/shared/commands/run/run.c |
Updates local FD_LOG_ERR_NOEXIT macro to pass basename argument. |
src/app/fddev/dev1.c |
Updates local FD_LOG_ERR_NOEXIT macro to pass basename argument. |
You can also share your feedback on Copilot code review. Take the survey.
Only print the source file name, but not the full source path, to stderr log.
57cdb04 to
962e442
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts Firedancer’s logging so stderr output shows only the source file basename (e.g., file.c) instead of the full/relative source path, while preserving the full path in the permanent logfile stream.
Changes:
- Introduces
FD_SRC_FILEto derive the basename of__FILE__and uses it for stderr-oriented log output. - Updates
fd_log_private_1/fd_log_private_2to accept both a full path and a basename, printing basename to stderr and path to the logfile. - Updates a few local
FD_LOG_ERR_NOEXIThelpers and documentation examples to reflect the new stderr formatting.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/util/log/fd_log.h | Adds FD_SRC_FILE, updates log macros and function prototypes, and refreshes example output for stderr. |
| src/util/log/fd_log.c | Implements new fd_log_private_{1,2} signature and switches stderr formatting to use basename. |
| src/disco/keyguard/fd_keyguard_proofs.c | Updates CBMC stub signatures to match new fd_log_private_{1,2} prototypes. |
| src/app/shared_dev/commands/dev.c | Updates local FD_LOG_ERR_NOEXIT macro to pass basename to logging. |
| src/app/shared/commands/run/run.c | Updates local FD_LOG_ERR_NOEXIT macro to pass basename to logging. |
| src/app/fddev/dev1.c | Updates local FD_LOG_ERR_NOEXIT macro to pass basename to logging. |
You can also share your feedback on Copilot code review. Take the survey.
| #define FD_SRC_FILE (__builtin_strrchr( __FILE__, '/' ) ? __builtin_strrchr( __FILE__, '/' ) + 1 : __FILE__) /* compile time fold */ | ||
| #else | ||
| #include <string.h> | ||
| #define FD_SRC_FILE (strrchr( __FILE__, '/' ) ? strrchr( __FILE__, '/' ) + 1 : __FILE__) |
Only print the source file name, but not the full source path, to stderr log.
This works because according to C coding best practices compile unit names should be unique.
Before
After