github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-grpc-middleware/logging/logrus/grpclogger.go (about)

     1  // Copyright 2017 Michal Witkowski. All Rights Reserved.
     2  // See LICENSE for licensing terms.
     3  
     4  package grpc_logrus
     5  
     6  import (
     7  	"github.com/hxx258456/ccgo/grpc/grpclog"
     8  	"github.com/sirupsen/logrus"
     9  )
    10  
    11  // ReplaceGrpcLogger sets the given logrus.Logger as a gRPC-level logger.
    12  // This should be called *before* any other initialization, preferably from init() functions.
    13  func ReplaceGrpcLogger(logger *logrus.Entry) {
    14  	grpclog.SetLogger(logger.WithField("system", SystemField))
    15  }