-
Notifications
You must be signed in to change notification settings - Fork 15
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
Logger update #359
base: master
Are you sure you want to change the base?
Logger update #359
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 really like the simplification of the constructor and usage of std::chrono
.
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.
Overall good PR. I do not fully understand:
got rid of this in preparation for removing dependencies to MPI.
Are those dependencies removed in a future PR? What is the roadmap for this and why not in this one?
I would like to remove the MPI dependencies, but I think for the moment I will put my effort into other parts of the code/PRs first ... Consider this PR as ready after applying the suggested updates, now. :) |
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.
Just stumbled upon one more thing since you are refactoring the logger anyway 😇
CI seems to have some issues - seem to be some issues with AutoPas that also break tests for other PRs ...? |
Seems like the update to the GitHub Ubuntu images messed up something with the dependencies. I'll fix it later Working again in #360 |
Signed-off-by: Christoph Niethammer <[email protected]>
Implement set_log_stream to change the output stream of the logger after logger construction. Signed-off-by: Christoph Niethammer <[email protected]>
Construct the global logger just after MPI_init with the default output stream (stdout). After command line parsing, switch the output stream of the global logger to a logfile if requested via the '--logfile' command line option. Signed-off-by: Christoph Niethammer <[email protected]>
As now the logger output stream can be set after default construction, remove the constructor for logfiles as it is not used any more. This also helps removing the MPI code from the logger. Signed-off-by: Christoph Niethammer <[email protected]>
The Logger constructor now takes a shared pointer to a std::ostream. In this way we do not need the error prone handling of manual stream descruction any more. Instead the default shared pointer argument for std::cout takes now the no-op deleter. Signed-off-by: Christoph Niethammer <[email protected]>
Co-authored-by: FG-TUM <[email protected]>
Signed-off-by: Christoph Niethammer <[email protected]>
Signed-off-by: Christoph Niethammer <[email protected]>
Signed-off-by: Christoph Niethammer <[email protected]>
A logger can now be copied, as it does not manage the stream it logs to itself but keeps an shared pointer, now. Signed-off-by: Christoph Niethammer <[email protected]>
Signed-off-by: Christoph Niethammer <[email protected]>
Just comparing a single character is not a good idea: 'do not log anything please' would enable debug output ... Skipping uppercase conversion as we always emit an error if the provided level name cannot be identified. Signed-off-by: Christoph Niethammer <[email protected]>
01f655a
to
3c6e79c
Compare
Rebased and force pushed after CI update to rerun tests |
@FG-TUM: CI now looks good - not sure which change requests are still open ... may have got lost due to the manual push updates? |
Added the possibility to change the output stream of the logger. The logger is now default initialized with output to std::cout right after
MPI_init
. The output is changed to a log file later if requested via command line arguments. This resolves the segfault brought up during the review of PR #355 and takes into account the comments on the initial fix in PR #358.As the explicit constructor for logfiles is not needed any more, now, got rid of this in preparation for removing dependencies to MPI.
Also, refactored the time output code to use std::chrono where possible
Update:
Allow copying of loggers.
Fixed setting the log level by string: now case-matches instead of just looking for the leading character.