Skip to content

Conversation

@kowalej
Copy link

@kowalej 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).

logger.h Outdated
namespace Logger {
static std::mutex print_lock;

inline void log_info(const std::string &msg, const bool std_out = true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cboulay cboulay force-pushed the master branch 4 times, most recently from 24f7442 to 04e3db7 Compare January 9, 2019 20:43
@tstenner tstenner force-pushed the master branch 2 times, most recently from 02a04ba to 6b0d4ec Compare December 30, 2022 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants