updates to logging to automatically include file name, function name …#9
updates to logging to automatically include file name, function name …#9jefhai wants to merge 4 commits intotravisdesell:mainfrom
Conversation
…and execution line. this will be useful for debugging. formating improvements will allow us to use GUI tools for log viewing
|
@travisdesell the idea was to improve logging by determining where a log function was invoked. Still need to compile and test this on Ubuntu and cluster. Working on my Mac without modifying CMake or environment variables. Some more work to be done to get log messages to be well formatted in output. Delimiting log message sections with ':' so we can use some GUI log viewers for search and filtering. |
|
travisdesell
left a comment
There was a problem hiding this comment.
I'm a little worried a bout performance effects of this change. The reason I had the va_list/va_start buried a bit further into the functions was to only use them when needed -- many times (depending on log level) they'll never be needed if the message is ignored.
|
Just a thought -- is it possible to put the guards in the |
|
My thought is that then the compiler might even be able to optimize out those statements. Which would be ideal especially if a block of code had a number of trace/debug statements that could really slow things down. |
|
Right that makes sense, i.e. ideally avoid prep work prior to log calls. I removed Logs that used So to get performance, shut logs off by potentially disabling them at compile time. Review existing use of log to make sure additional work to prepare a log message is minimized. |
|
@travisdesell so won't get optimized away because |
|
Yeah I think it's worth doing because branch prediction should be pretty good at catching them and it will save us unneeded function calls. I imagine eventually we could set things up where we also had a compile flag to specify logging levels if we really wanted to squeeze out some more performance. |
… provided argument parameter functions
|
@travisdesell So two observations implementing this.
|
| } | ||
|
|
||
| bool Log::should_log(log_level_t level) { | ||
| return !(std_message_level < level && file_message_level < level) |
…and execution line. this will be useful for debugging. formating improvements will allow us to use GUI tools for log viewing