Add logging utility which prints messages to standard output synchronously.#13
Open
kowalej wants to merge 3 commits intolabstreaminglayer:masterfrom
Open
Add logging utility which prints messages to standard output synchronously.#13kowalej wants to merge 3 commits intolabstreaminglayer:masterfrom
kowalej wants to merge 3 commits intolabstreaminglayer:masterfrom
Conversation
kowalej
commented
Dec 17, 2018
- Logging utility class with mutex to prevent multiple threads from writing ugly run-on messages in the console.
- Log functions for various levels (info, warning, or error) which can be hooked into for future logging (text file logging or otherwise).
tstenner
requested changes
Dec 17, 2018
logger.h
Outdated
| namespace Logger { | ||
| static std::mutex print_lock; | ||
|
|
||
| inline void log_info(const std::string &msg, const bool std_out = true) { |
Contributor
There was a problem hiding this comment.
All log methods have the same signature and contents, so I'd rather have a single log function that takes the level as parameter. std_out is unused, so I'd remove it. It's a header only inline function so we can add a default parameter later anyway
Author
There was a problem hiding this comment.
I agree with removing currently uneeded stdout flag param. However I think it's better for usability to keep the levels as different functions. This "function per log level" is pretty standard in logging libraries.
24f7442 to
04e3db7
Compare
02a04ba to
6b0d4ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.