Closed aaronlehmann closed 8 years ago
This is a classic error in logging for highly concurrent systems (seen this in Go and gevent). Rather than remove the portion of the logger, as that removes context, just evaluate the string at the callsite with fmt.Sprint
. That way we keep the context and don't cause this error.
@stevvooe: I've changed this to continue logging the sink, and add String
methods to the sinks that can't safely be dumped directly by reflection.
Though a little odd, LGTM
Some log messages add an events.sink field whose value is the actual sink object. Trying to log this can cause a data race, because some sinks contain a sync.Once field:
To avoid the data race, add String methods to objects that aren't safe to serialize directly. These serialize a copy that excludes the sync.Once.