mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 15:23:29 +03:00
logging: Add subsystem to log API (#19002)
Create new code paths for multiple subsystems in the code. This will make maintaing this easier later. Also introduce bugLogIf() for errors that should not happen in the first place.
This commit is contained in:
@@ -27,7 +27,6 @@ import (
|
||||
|
||||
"github.com/minio/minio/internal/hash/sha256"
|
||||
xioutil "github.com/minio/minio/internal/ioutil"
|
||||
"github.com/minio/minio/internal/logger"
|
||||
"github.com/tinylib/msgp/msgp"
|
||||
)
|
||||
|
||||
@@ -466,7 +465,7 @@ func (h *SingleHandler[Req, Resp]) AllowCallRequestPool(b bool) *SingleHandler[R
|
||||
// This may only be set ONCE before use.
|
||||
func (h *SingleHandler[Req, Resp]) IgnoreNilConn() *SingleHandler[Req, Resp] {
|
||||
if h.ignoreNilConn {
|
||||
logger.LogOnceIf(context.Background(), fmt.Errorf("%s: IgnoreNilConn called twice", h.id.String()), h.id.String()+"IgnoreNilConn")
|
||||
gridLogOnceIf(context.Background(), fmt.Errorf("%s: IgnoreNilConn called twice", h.id.String()), h.id.String()+"IgnoreNilConn")
|
||||
}
|
||||
h.ignoreNilConn = true
|
||||
return h
|
||||
@@ -767,7 +766,7 @@ func (h *StreamTypeHandler[Payload, Req, Resp]) register(m *Manager, handle func
|
||||
input := h.NewRequest()
|
||||
_, err := input.UnmarshalMsg(v)
|
||||
if err != nil {
|
||||
logger.LogOnceIf(ctx, err, err.Error())
|
||||
gridLogOnceIf(ctx, err, err.Error())
|
||||
}
|
||||
PutByteBuffer(v)
|
||||
// Send input
|
||||
@@ -791,7 +790,7 @@ func (h *StreamTypeHandler[Payload, Req, Resp]) register(m *Manager, handle func
|
||||
}
|
||||
dst, err := v.MarshalMsg(GetByteBufferCap(v.Msgsize()))
|
||||
if err != nil {
|
||||
logger.LogOnceIf(ctx, err, err.Error())
|
||||
gridLogOnceIf(ctx, err, err.Error())
|
||||
}
|
||||
if !h.sharedResponse {
|
||||
h.PutResponse(v)
|
||||
@@ -877,7 +876,7 @@ func (h *StreamTypeHandler[Payload, Req, Resp]) Call(ctx context.Context, c Stre
|
||||
for req := range reqT {
|
||||
b, err := req.MarshalMsg(GetByteBufferCap(req.Msgsize()))
|
||||
if err != nil {
|
||||
logger.LogOnceIf(ctx, err, err.Error())
|
||||
gridLogOnceIf(ctx, err, err.Error())
|
||||
}
|
||||
h.PutRequest(req)
|
||||
stream.Requests <- b
|
||||
|
||||
Reference in New Issue
Block a user