Protect logger targets (#13529)

Logger targets were not race protected against concurrent updates from for example `HTTPConsoleLoggerSys`.

Restrict direct access to targets and make slices immutable so a returned slice can be processed safely without locks.
This commit is contained in:
Klaus Post
2021-10-28 07:35:28 -07:00
committed by GitHub
parent bd88b86919
commit d9c1d79e30
6 changed files with 75 additions and 13 deletions

View File

@@ -516,7 +516,7 @@ func (a *auditObjectErasureMap) MarshalJSON() ([]byte, error) {
}
func auditObjectErasureSet(ctx context.Context, object string, set *erasureObjects) {
if len(logger.AuditTargets) == 0 {
if len(logger.AuditTargets()) == 0 {
return
}