fix: Fix crash when logging events and anonymous is enabled (#19313)

Events log does not have a stacktrace. So Trace is nil. Fix a crash in
this case when an event is printed while anonymous logging is enabled.
This commit is contained in:
Anis Eleuch 2024-03-21 18:19:36 +01:00 committed by GitHub
parent 55778ae278
commit b657ffa496
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -364,7 +364,9 @@ func buildLogEntry(ctx context.Context, message string, trace []string, errKind
entry.API.Args.Bucket = HashString(entry.API.Args.Bucket)
entry.API.Args.Object = HashString(entry.API.Args.Object)
entry.RemoteHost = HashString(entry.RemoteHost)
entry.Trace.Variables = make(map[string]interface{})
if entry.Trace != nil {
entry.Trace.Variables = make(map[string]interface{})
}
}
return entry