go-logging icon indicating copy to clipboard operation
go-logging copied to clipboard

[Backend][Reentrant] Introduce Reentrant Backend

Open nplanel opened this issue 9 years ago • 6 comments

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 ./...

nplanel avatar Mar 27 '16 15:03 nplanel

It's seems you testing your code with very old golang version, atomic.Value request Golang >= 1.4

nplanel avatar Mar 27 '16 15:03 nplanel

@op : Did you have time to look my patch ?

nplanel avatar Apr 07 '16 13:04 nplanel

@nplanel Sorry for the silence. Been very busy lately. Will try to get some time.

op avatar Apr 20 '16 12:04 op

@op ok no pb, If you look at the commit, one is a bugfix that you can apply/cherry-pick today.

nplanel avatar Apr 21 '16 05:04 nplanel

@op Any update ?

nplanel avatar Jun 02 '16 09:06 nplanel

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!)

driskell avatar Jun 10 '16 08:06 driskell