-
Notifications
You must be signed in to change notification settings - Fork 32
less couts during advances in release mode #885
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,8 +15,10 @@ constexpr static std::uint8_t LOG_LEVEL = PHARE_LOG_LEVEL; | |
| #if !defined(NDEBUG) || defined(PHARE_FORCE_DEBUG_DO) | ||
| #define PHARE_LOG_LINE_STR(str) \ | ||
| std::cout << __FILE__ << ":" << __LINE__ << " - " << str << std::endl; | ||
| #define PHARE_LOG_LINE_SS(s) PHARE_LOG_LINE_STR((std::stringstream{} << s).str()); | ||
| #else | ||
| #define PHARE_LOG_LINE_STR(str) | ||
| #define PHARE_LOG_LINE_SS(str) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure macro definitions are consistent across build configurations. The macro Verify that the macro is either consistently defined or appropriately disabled across all configurations. If disabling is the choice, ensure that it does not lead to any unresolved references during compilation in release mode.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is so we do not print lines during release mode with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @PhilipDeegan, thank you for the clarification. The conditional definition of the macro makes sense to avoid unnecessary logging in release mode with |
||
| #endif | ||
| #define PHARE_LOG_LINE PHARE_LOG_LINE_STR("") | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor the macro parameter for consistency.
The macro
PHARE_LOG_LINE_SSusessas a parameter, which is inconsistent with the change noted in the alterations summary that suggests it should bestr. This inconsistency can lead to confusion and potential errors in macro usage.Consider renaming the parameter to match the intended usage and documentation:
Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it's a macro, it would not be advisable to use the input parameter
stras it might conflict with thestringstream::str()callThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PhilipDeegan, you're absolutely right. Using
stras a parameter name in the macro could indeed lead to conflicts with thestringstream::str()method. Keeping the parameter name assis the best approach to avoid any potential issues. Thanks for the clarification!