3
* Copyright 2020 gRPC authors.
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
19
// Package grpclog (internal) defines depth logging for grpc.
26
// Logger is the logger used for the non-depth log functions.
29
// DepthLogger is the logger used for the depth log functions.
30
var DepthLogger DepthLoggerV2
32
// InfoDepth logs to the INFO log at the specified depth.
33
func InfoDepth(depth int, args ...interface{}) {
34
if DepthLogger != nil {
35
DepthLogger.InfoDepth(depth, args...)
37
Logger.Infoln(args...)
41
// WarningDepth logs to the WARNING log at the specified depth.
42
func WarningDepth(depth int, args ...interface{}) {
43
if DepthLogger != nil {
44
DepthLogger.WarningDepth(depth, args...)
46
Logger.Warningln(args...)
50
// ErrorDepth logs to the ERROR log at the specified depth.
51
func ErrorDepth(depth int, args ...interface{}) {
52
if DepthLogger != nil {
53
DepthLogger.ErrorDepth(depth, args...)
55
Logger.Errorln(args...)
59
// FatalDepth logs to the FATAL log at the specified depth.
60
func FatalDepth(depth int, args ...interface{}) {
61
if DepthLogger != nil {
62
DepthLogger.FatalDepth(depth, args...)
64
Logger.Fatalln(args...)
69
// LoggerV2 does underlying logging work for grpclog.
70
// This is a copy of the LoggerV2 defined in the external grpclog package. It
71
// is defined here to avoid a circular dependency.
72
type LoggerV2 interface {
73
// Info logs to INFO log. Arguments are handled in the manner of fmt.Print.
74
Info(args ...interface{})
75
// Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println.
76
Infoln(args ...interface{})
77
// Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf.
78
Infof(format string, args ...interface{})
79
// Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print.
80
Warning(args ...interface{})
81
// Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println.
82
Warningln(args ...interface{})
83
// Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf.
84
Warningf(format string, args ...interface{})
85
// Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.
86
Error(args ...interface{})
87
// Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println.
88
Errorln(args ...interface{})
89
// Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
90
Errorf(format string, args ...interface{})
91
// Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print.
92
// gRPC ensures that all Fatal logs will exit with os.Exit(1).
93
// Implementations may also call os.Exit() with a non-zero exit code.
94
Fatal(args ...interface{})
95
// Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println.
96
// gRPC ensures that all Fatal logs will exit with os.Exit(1).
97
// Implementations may also call os.Exit() with a non-zero exit code.
98
Fatalln(args ...interface{})
99
// Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
100
// gRPC ensures that all Fatal logs will exit with os.Exit(1).
101
// Implementations may also call os.Exit() with a non-zero exit code.
102
Fatalf(format string, args ...interface{})
103
// V reports whether verbosity level l is at least the requested verbose level.
107
// DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements
108
// DepthLoggerV2, the below functions will be called with the appropriate stack
109
// depth set for trivial functions the logger may ignore.
110
// This is a copy of the DepthLoggerV2 defined in the external grpclog package.
111
// It is defined here to avoid a circular dependency.
115
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
117
type DepthLoggerV2 interface {
118
// InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Print.
119
InfoDepth(depth int, args ...interface{})
120
// WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Print.
121
WarningDepth(depth int, args ...interface{})
122
// ErrorDetph logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Print.
123
ErrorDepth(depth int, args ...interface{})
124
// FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Print.
125
FatalDepth(depth int, args ...interface{})