Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deep copy the fields to avoid data race (#128)
* fix(test): use sublogger generated from With() in race detection The new sublogger generated from With() are never used, which may cause optimization of the sublogger, and no race condition is detected. Use a for loop to spawn a lots of goroutines to ensure the race condition would happen in CI. We also need to replace the bytes.Buffer to io.Discard, since the bytes.Buffer is also not thread-safe. Signed-off-by: yuguorui <[email protected]> * fix: deep copy the fields to avoid data race sl.fields and l.fields reference the the same object, when we create multiple goroutines and bump loggers with the With() method, the golang race detector will complain about this. Signed-off-by: yuguorui <[email protected]> --------- Signed-off-by: yuguorui <[email protected]>
- Loading branch information