Simplify error logging on event send (#20246)

Overly verbose, hard to read and can leak data.

Print even as JSON and simplify target&error printing.
This commit is contained in:
Klaus Post 2024-08-12 08:55:28 -07:00 committed by GitHub
parent 2e0fd2cba9
commit d8f0e0ea6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,6 +20,7 @@ package logger
import ( import (
"context" "context"
"encoding/hex" "encoding/hex"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"go/build" "go/build"
@ -421,7 +422,8 @@ func sendLog(ctx context.Context, entry log.Entry) {
for _, t := range systemTgts { for _, t := range systemTgts {
if err := t.Send(ctx, entry); err != nil { if err := t.Send(ctx, entry); err != nil {
if consoleTgt != nil { // Sending to the console never fails if consoleTgt != nil { // Sending to the console never fails
entry.Trace.Message = fmt.Sprintf("event(%#v) was not sent to Logger target (%#v): %#v", entry, t, err) b, _ := json.Marshal(entry)
entry.Trace.Message = fmt.Sprintf("sendLog: event %s was not sent to Logger target (%v): %v", string(b), t.String(), err.Error())
consoleTgt.Send(ctx, entry) consoleTgt.Send(ctx, entry)
} }
} }