Skip to content
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

Add logging utility which prints messages to standard output synchronously. #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

recording.cpp Outdated Show resolved Hide resolved
recording.h Outdated Show resolved Hide resolved
@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.

None yet

2 participants