-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use init for gRPC log redirection (#29)
- Loading branch information
Showing
3 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2024 The nilgo authors | ||
// Use of this source code is governed by a MIT license found in the LICENSE file. | ||
|
||
package grpc | ||
|
||
import ( | ||
"log/slog" | ||
|
||
"google.golang.org/grpc/grpclog" | ||
|
||
"github.com/nil-go/nilgo/grpc/internal" | ||
) | ||
|
||
func init() { //nolint:gochecknoinits | ||
// Redirect gRPC log to slog. | ||
grpclog.SetLoggerV2(internal.NewSlogger(slog.Default().Handler())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters