Skip to content

Commit 76662e9

Browse files
committed
grpclog: move logging documentation from README to package doc comment
1 parent 1b7e50f commit 76662e9

2 files changed

Lines changed: 26 additions & 37 deletions

File tree

README.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -71,35 +71,8 @@ Please update to the latest version of gRPC-Go using
7171

7272
### How to turn on logging
7373

74-
The default logger is controlled by environment variables. Turn everything on
75-
like this:
76-
77-
```console
78-
$ export GRPC_GO_LOG_VERBOSITY_LEVEL=99
79-
$ export GRPC_GO_LOG_SEVERITY_LEVEL=info
80-
```
81-
82-
Additionally, you can configure log severity levels for individual components
83-
using the `GRPC_GO_COMPONENT_LOG_LEVEL` environment variable. The format is a
84-
comma-separated list of `component:LEVEL` pairs like this:
85-
86-
```console
87-
$ export GRPC_GO_COMPONENT_LOG_LEVEL=dns:ERROR,transport:WARNING
88-
```
89-
90-
When both `GRPC_GO_LOG_SEVERITY_LEVEL` and `GRPC_GO_COMPONENT_LOG_LEVEL` are
91-
set, component-specific settings take precedence over `GRPC_GO_LOG_SEVERITY_LEVEL`
92-
for the specified components. Components not listed in
93-
`GRPC_GO_COMPONENT_LOG_LEVEL` will use the `GRPC_GO_LOG_SEVERITY_LEVEL` setting.
94-
For example:
95-
96-
```console
97-
$ export GRPC_GO_LOG_SEVERITY_LEVEL=ERROR
98-
$ export GRPC_GO_COMPONENT_LOG_LEVEL=dns:INFO
99-
```
100-
101-
In this case, the `dns` component will log at `INFO` level, while all other
102-
components will log at `ERROR` level.
74+
See the [grpclog package documentation](https://pkg.go.dev/google.golang.org/grpc/grpclog)
75+
for details on how to configure logging.
10376

10477
### The RPC failed with error `"code = Unavailable desc = transport is closing"`
10578

grpclog/grpclog.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,30 @@
1818

1919
// Package grpclog defines logging for grpc.
2020
//
21-
// In the default logger, severity level can be set by environment variable
22-
// GRPC_GO_LOG_SEVERITY_LEVEL, verbosity level can be set by
23-
// GRPC_GO_LOG_VERBOSITY_LEVEL.
24-
//
25-
// Per-component severity level can be set by GRPC_GO_COMPONENT_LOG_LEVEL with
26-
// format "component1:LEVEL,component2:LEVEL" (e.g., "dns:error,xds:warning").
27-
// Component-specific settings take precedence over GRPC_GO_LOG_SEVERITY_LEVEL
28-
// for that component.
21+
// The default logger is controlled by environment variables. Turn
22+
// everything on like this:
23+
//
24+
// export GRPC_GO_LOG_VERBOSITY_LEVEL=99
25+
// export GRPC_GO_LOG_SEVERITY_LEVEL=info
26+
//
27+
// Additionally, you can configure log severity levels for individual
28+
// components using the GRPC_GO_COMPONENT_LOG_LEVEL environment
29+
// variable. The format is a comma-separated list of component:LEVEL
30+
// pairs like this:
31+
//
32+
// export GRPC_GO_COMPONENT_LOG_LEVEL=dns:ERROR,transport:WARNING
33+
//
34+
// When both GRPC_GO_LOG_SEVERITY_LEVEL and GRPC_GO_COMPONENT_LOG_LEVEL
35+
// are set, component-specific settings take precedence over
36+
// GRPC_GO_LOG_SEVERITY_LEVEL for the specified components. Components
37+
// not listed in GRPC_GO_COMPONENT_LOG_LEVEL will use the
38+
// GRPC_GO_LOG_SEVERITY_LEVEL setting. For example:
39+
//
40+
// export GRPC_GO_LOG_SEVERITY_LEVEL=ERROR
41+
// export GRPC_GO_COMPONENT_LOG_LEVEL=dns:INFO
42+
//
43+
// In this case, the dns component will log at INFO level, while all
44+
// other components will log at ERROR level.
2945
package grpclog
3046

3147
import (

0 commit comments

Comments
 (0)