3 * Copyright 2017 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 defines logging for grpc.
21 // All logs in transport package only go to verbose level 2.
22 // All logs in other packages in grpc are logged in spite of the verbosity level.
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"
31 var logger = newLoggerV2()
33 // V reports whether verbosity level l is at least the requested verbose level.
38 // Info logs to the INFO log.
39 func Info(args ...interface{}) {
43 // Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf.
44 func Infof(format string, args ...interface{}) {
45 logger.Infof(format, args...)
48 // Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println.
49 func Infoln(args ...interface{}) {
50 logger.Infoln(args...)
53 // Warning logs to the WARNING log.
54 func Warning(args ...interface{}) {
55 logger.Warning(args...)
58 // Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf.
59 func Warningf(format string, args ...interface{}) {
60 logger.Warningf(format, args...)
63 // Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println.
64 func Warningln(args ...interface{}) {
65 logger.Warningln(args...)
68 // Error logs to the ERROR log.
69 func Error(args ...interface{}) {
73 // Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf.
74 func Errorf(format string, args ...interface{}) {
75 logger.Errorf(format, args...)
78 // Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println.
79 func Errorln(args ...interface{}) {
80 logger.Errorln(args...)
83 // Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print.
84 // It calls os.Exit() with exit code 1.
85 func Fatal(args ...interface{}) {
87 // Make sure fatal logs will exit.
91 // Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf.
92 // It calles os.Exit() with exit code 1.
93 func Fatalf(format string, args ...interface{}) {
94 logger.Fatalf(format, args...)
95 // Make sure fatal logs will exit.
99 // Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println.
100 // It calle os.Exit()) with exit code 1.
101 func Fatalln(args ...interface{}) {
102 logger.Fatalln(args...)
103 // Make sure fatal logs will exit.
107 // Print prints to the logger. Arguments are handled in the manner of fmt.Print.
109 // Deprecated: use Info.
110 func Print(args ...interface{}) {
114 // Printf prints to the logger. Arguments are handled in the manner of fmt.Printf.
116 // Deprecated: use Infof.
117 func Printf(format string, args ...interface{}) {
118 logger.Infof(format, args...)
121 // Println prints to the logger. Arguments are handled in the manner of fmt.Println.
123 // Deprecated: use Infoln.
124 func Println(args ...interface{}) {
125 logger.Infoln(args...)