-
Notifications
You must be signed in to change notification settings - Fork 172
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
Fix default enabled debug output during realm-sync-tests #6234
Conversation
test/util/unit_test.cpp
Outdated
@@ -413,29 +413,22 @@ class WildcardFilter : public Filter { | |||
class IntraTestLogger : public Logger { | |||
public: | |||
// Logger with a local log level used for the different test threads | |||
// A new log level threshold atomic will be used for this logger, but | |||
// it will write to the base_logger_ptr when do_log() is called | |||
IntraTestLogger(const std::shared_ptr<Logger>& base_logger_ptr, Level threshold) |
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.
can you write a real quick little test that instantiates an IntraTestLogger at like trace or debug level and then verify that it actually respects that?
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.
Added test, but I needed to move the IntraTestLogger
to logger.hpp - I renamed the class to LocalThresholdLogger
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.
LGTM.
What, How & Why?
When the log level threshold was updated to be atomic, the
IntraTestLogger
was updated to provide its own log level threshold, but this value was not being used properly by subsequent loggers that were linked to this object. An instance of theIntraTestLogger
is used by each of the test threads in a unit test run to prevent changes in one thread from affecting the other threads, but they all print out using a single root logger (protected by aThreadSafeLogger
) that is created when the test is started.Fix the level threshold in the
IntraTestLogger
so it has its own atomic log level threshold that is used by linked loggers.Fixes #6233
☑️ ToDos
[ ] C-API, if public C++ API changed.