18
18
19
19
// Package grpclog defines logging for grpc.
20
20
//
21
- // All logs in transport and grpclb packages only go to verbose level 2.
22
- // All logs in other packages in grpc are logged in spite of the verbosity level.
23
- //
24
- // In the default logger,
25
- // severity level can be set by environment variable GRPC_GO_LOG_SEVERITY_LEVEL,
26
- // verbosity level can be set by GRPC_GO_LOG_VERBOSITY_LEVEL.
27
- package grpclog // import "google.golang.org/grpc/grpclog"
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
+ package grpclog
28
25
29
26
import (
30
27
"os"
31
28
32
- "google.golang.org/grpc/internal/ grpclog"
29
+ "google.golang.org/grpc/grpclog/internal "
33
30
)
34
31
35
32
func init () {
@@ -38,74 +35,74 @@ func init() {
38
35
39
36
// V reports whether verbosity level l is at least the requested verbose level.
40
37
func V (l int ) bool {
41
- return grpclog . Logger .V (l )
38
+ return internal . LoggerV2Impl .V (l )
42
39
}
43
40
44
41
// Info logs to the INFO log.
45
42
func Info (args ... any ) {
46
- grpclog . Logger .Info (args ... )
43
+ internal . LoggerV2Impl .Info (args ... )
47
44
}
48
45
49
46
// Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf.
50
47
func Infof (format string , args ... any ) {
51
- grpclog . Logger .Infof (format , args ... )
48
+ internal . LoggerV2Impl .Infof (format , args ... )
52
49
}
53
50
54
51
// Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println.
55
52
func Infoln (args ... any ) {
56
- grpclog . Logger .Infoln (args ... )
53
+ internal . LoggerV2Impl .Infoln (args ... )
57
54
}
58
55
59
56
// Warning logs to the WARNING log.
60
57
func Warning (args ... any ) {
61
- grpclog . Logger .Warning (args ... )
58
+ internal . LoggerV2Impl .Warning (args ... )
62
59
}
63
60
64
61
// Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf.
65
62
func Warningf (format string , args ... any ) {
66
- grpclog . Logger .Warningf (format , args ... )
63
+ internal . LoggerV2Impl .Warningf (format , args ... )
67
64
}
68
65
69
66
// Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println.
70
67
func Warningln (args ... any ) {
71
- grpclog . Logger .Warningln (args ... )
68
+ internal . LoggerV2Impl .Warningln (args ... )
72
69
}
73
70
74
71
// Error logs to the ERROR log.
75
72
func Error (args ... any ) {
76
- grpclog . Logger .Error (args ... )
73
+ internal . LoggerV2Impl .Error (args ... )
77
74
}
78
75
79
76
// Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf.
80
77
func Errorf (format string , args ... any ) {
81
- grpclog . Logger .Errorf (format , args ... )
78
+ internal . LoggerV2Impl .Errorf (format , args ... )
82
79
}
83
80
84
81
// Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println.
85
82
func Errorln (args ... any ) {
86
- grpclog . Logger .Errorln (args ... )
83
+ internal . LoggerV2Impl .Errorln (args ... )
87
84
}
88
85
89
86
// Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print.
90
87
// It calls os.Exit() with exit code 1.
91
88
func Fatal (args ... any ) {
92
- grpclog . Logger .Fatal (args ... )
89
+ internal . LoggerV2Impl .Fatal (args ... )
93
90
// Make sure fatal logs will exit.
94
91
os .Exit (1 )
95
92
}
96
93
97
94
// Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf.
98
95
// It calls os.Exit() with exit code 1.
99
96
func Fatalf (format string , args ... any ) {
100
- grpclog . Logger .Fatalf (format , args ... )
97
+ internal . LoggerV2Impl .Fatalf (format , args ... )
101
98
// Make sure fatal logs will exit.
102
99
os .Exit (1 )
103
100
}
104
101
105
102
// Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println.
106
103
// It calls os.Exit() with exit code 1.
107
104
func Fatalln (args ... any ) {
108
- grpclog . Logger .Fatalln (args ... )
105
+ internal . LoggerV2Impl .Fatalln (args ... )
109
106
// Make sure fatal logs will exit.
110
107
os .Exit (1 )
111
108
}
@@ -114,19 +111,76 @@ func Fatalln(args ...any) {
114
111
//
115
112
// Deprecated: use Info.
116
113
func Print (args ... any ) {
117
- grpclog . Logger .Info (args ... )
114
+ internal . LoggerV2Impl .Info (args ... )
118
115
}
119
116
120
117
// Printf prints to the logger. Arguments are handled in the manner of fmt.Printf.
121
118
//
122
119
// Deprecated: use Infof.
123
120
func Printf (format string , args ... any ) {
124
- grpclog . Logger .Infof (format , args ... )
121
+ internal . LoggerV2Impl .Infof (format , args ... )
125
122
}
126
123
127
124
// Println prints to the logger. Arguments are handled in the manner of fmt.Println.
128
125
//
129
126
// Deprecated: use Infoln.
130
127
func Println (args ... any ) {
131
- grpclog .Logger .Infoln (args ... )
128
+ internal .LoggerV2Impl .Infoln (args ... )
129
+ }
130
+
131
+ // InfoDepth logs to the INFO log at the specified depth.
132
+ //
133
+ // # Experimental
134
+ //
135
+ // Notice: This API is EXPERIMENTAL and may be changed or removed in a
136
+ // later release.
137
+ func InfoDepth (depth int , args ... any ) {
138
+ if internal .DepthLoggerV2Impl != nil {
139
+ internal .DepthLoggerV2Impl .InfoDepth (depth , args ... )
140
+ } else {
141
+ internal .LoggerV2Impl .Infoln (args ... )
142
+ }
143
+ }
144
+
145
+ // WarningDepth logs to the WARNING log at the specified depth.
146
+ //
147
+ // # Experimental
148
+ //
149
+ // Notice: This API is EXPERIMENTAL and may be changed or removed in a
150
+ // later release.
151
+ func WarningDepth (depth int , args ... any ) {
152
+ if internal .DepthLoggerV2Impl != nil {
153
+ internal .DepthLoggerV2Impl .WarningDepth (depth , args ... )
154
+ } else {
155
+ internal .LoggerV2Impl .Warningln (args ... )
156
+ }
157
+ }
158
+
159
+ // ErrorDepth logs to the ERROR log at the specified depth.
160
+ //
161
+ // # Experimental
162
+ //
163
+ // Notice: This API is EXPERIMENTAL and may be changed or removed in a
164
+ // later release.
165
+ func ErrorDepth (depth int , args ... any ) {
166
+ if internal .DepthLoggerV2Impl != nil {
167
+ internal .DepthLoggerV2Impl .ErrorDepth (depth , args ... )
168
+ } else {
169
+ internal .LoggerV2Impl .Errorln (args ... )
170
+ }
171
+ }
172
+
173
+ // FatalDepth logs to the FATAL log at the specified depth.
174
+ //
175
+ // # Experimental
176
+ //
177
+ // Notice: This API is EXPERIMENTAL and may be changed or removed in a
178
+ // later release.
179
+ func FatalDepth (depth int , args ... any ) {
180
+ if internal .DepthLoggerV2Impl != nil {
181
+ internal .DepthLoggerV2Impl .FatalDepth (depth , args ... )
182
+ } else {
183
+ internal .LoggerV2Impl .Fatalln (args ... )
184
+ }
185
+ os .Exit (1 )
132
186
}
0 commit comments