-
Type: Task
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
?
-
6012
-
Not Needed
For PR 5980, the primary classes that owned a reference to the Logger were updated to hold a shared_ptr instead of a reference to the logger held as a unique_ptr by the SyncManager. This improved the predictability of the lifetime of the logger, but also introduced a lot of changes.
To minimize some of the changes, two variables are used when the shared_ptr is used:
std::shared_ptr<util::Logger> logger_ptr; util::Logger& logger; // initialized with logger{*logger_ptr};
This allows the existing logger output calls to remain in tact, while updating the underlying storage of the logger, but can be confusing without context as to why the choice was made.
Consider migrating the double variables to just use the shared_ptr. It is guaranteed that the owning object will have a logger initialized in the constructor, so checking the shared_ptr every time a logging function is called is not necessary. For extra verification, an ASSERT can be added to the body of the constructor to verify the Logger is not a nullptr.