-
Notifications
You must be signed in to change notification settings - Fork 123
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
added filename and line number to logs #2637
base: main
Are you sure you want to change the base?
Conversation
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.
I don't know... This might be adding a lot of usually not needed noise to messages. I feel like this should be an option.
|
||
#define URLOG_ALWAYS_IMPL(format, ...) \ | ||
{ ::logger::get_logger().always(format " <{}:{}>", __VA_ARGS__); } | ||
#define URLOG_ALWAYS(...) URLOG_ALWAYS_IMPL(__VA_ARGS__, SHORT_FILE, __LINE__) |
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.
why a macro and not a function?
nvm, I didn't look at the code. We'd need __LINE__
...
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.
This has to be a macro because we need __LINE__
and __FILE__
from the place of log statement, not from the place of of function definition.
My opinion is that filename and line number is crucial for efficient log analysis, unless you work for a long time in a project and perfectly know the code. When I realized UR don't have it I feel it is a must - hence the PR. Still when writing a log statement one can write it in old way and in this case log statement will appear without line and number. |
Example change. Instead of
there is now:
Review seems to be big but in fact is very short. The only essential change is a few lines in ur_logger.hpp and two lines in CMakeLists.txt
The rest was automated change of log statements from
logger::xxx(...)
toURLOG(XXX, ...)