Closed telic closed 2 years ago
I haven't integrated the log into the deployed tools yet (it's not in 'allchanges'), but it is "finished" in that it appears to work and all tests which use the log pass.
Interesting implementation. You've kinda moved the singleton inside DOM which makes me a little bit uneasy.
In reviewing it, I came across this line
That copy constructor assigns the log to the new DOM as it, a very shallow copy. So the new and old DOMs share the same log. That seems counter to your goals.
Since we're now using the isetools as a library for a multi-threaded web service, having a singleton Log really doesn't make sense. Separate users validating separate documents don't want to see each other's error messages :) Worse than that, because Log is not synchronized, multi-threaded use may even lead to crashes...
It looks like @emmental made some progress on rewriting Log so that there was a separate instance for each DOM, but I'm not sure how far he got with that approach. It looks like he has a branch for it at https://github.com/emmental/isetools/tree/separate_logs.
An alternate strategy might be simply to make Log a singleton-per-thread using
ThreadLocal
s. I imagine that would require a lot less work.