[Backend][Reentrant] Introduce Reentrant Backend
Level and memory backend are read mostly, so atomic value can a very limited effect on performance; Only write map acces need to be done under Mutex.
Now Backend loggers could be called from multiple goroutine.
Tests validated with : go test -v -race ./...
It's seems you testing your code with very old golang version, atomic.Value request Golang >= 1.4
@op : Did you have time to look my patch ?
@nplanel Sorry for the silence. Been very busy lately. Will try to get some time.
@op ok no pb, If you look at the commit, one is a bugfix that you can apply/cherry-pick today.
@op Any update ?
I thought I'd help out with some reviewing. Really would love to be able to set levels for all the loggers from a single routine. I'm thinking reloading configuration to enable debug logging - that would make diagnostics so much easier when a problem is happening.
I did have some concern with the handling though as it seems there may still be a race on the levels map. Not sure best way to get around that - but my first thought is why do we need to map lookup? Maybe each Logger need to pull in the level via sync.Value and it can access it there. Then it is fine to wrap the map in sync.Mutex since it'll only ever be used to lookup and set levels initially, and never during actual log calls (I think!)