Open ericmaxwell2003 opened 1 year ago
If you need to have two logger implementations and swap these out, you can just make a logger implementation that does that within itself.
The API was never meant to be used as "uninstall(), install()" as a way to swap impls, and I'd rather not relax NoLog just for a use case that the APIs aren't meant to support and that AFAIK can be implemented with a custom logger
I don't think it's safe to call
Because another thread could call
logcat { "Well intended message" }
between lines 1 and 2.It's true that uninstall sets the logger to NoLog which says nothing is loggable. This would likely just drop any logcat{} logs that come in on the floor.. but... I was thinking that since the logcat{} calls delegate to the logger without locking on Logcat (which is an obvious choice and makes sense, you don't want to lock on that), but since we don't, I think it could be (looking at the implementation)
Then the NoLog will throw an exception
tl;dr;
I think we should offer a replaceLogger something like..
And I think we should make NoLog gentler and something like