Welcome to mirror list, hosted at ThFree Co, Russian Federation.

grpclogger.go « logrus « logging « go-grpc-middleware « grpc-ecosystem « github.com « vendor - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c0f6c5ab5003472c2fa575f92ffa968eaca9c9b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright 2017 Michal Witkowski. All Rights Reserved.
// See LICENSE for licensing terms.

package grpc_logrus

import (
	"github.com/sirupsen/logrus"
	"google.golang.org/grpc/grpclog"
)

// ReplaceGrpcLogger sets the given logrus.Logger as a gRPC-level logger.
// This should be called *before* any other initialization, preferably from init() functions.
func ReplaceGrpcLogger(logger *logrus.Entry) {
	grpclog.SetLogger(logger.WithField("system", SystemField))
}