google.golang.org/grpc@v1.72.2/grpclog/internal/logger.go (about) 1 /* 2 * 3 * Copyright 2024 gRPC authors. 4 * 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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. 16 * 17 */ 18 19 package internal 20 21 // Logger mimics golang's standard Logger as an interface. 22 // 23 // Deprecated: use LoggerV2. 24 type Logger interface { 25 Fatal(args ...any) 26 Fatalf(format string, args ...any) 27 Fatalln(args ...any) 28 Print(args ...any) 29 Printf(format string, args ...any) 30 Println(args ...any) 31 } 32 33 // LoggerWrapper wraps Logger into a LoggerV2. 34 type LoggerWrapper struct { 35 Logger 36 } 37 38 // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. 39 func (l *LoggerWrapper) Info(args ...any) { 40 l.Logger.Print(args...) 41 } 42 43 // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. 44 func (l *LoggerWrapper) Infoln(args ...any) { 45 l.Logger.Println(args...) 46 } 47 48 // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. 49 func (l *LoggerWrapper) Infof(format string, args ...any) { 50 l.Logger.Printf(format, args...) 51 } 52 53 // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. 54 func (l *LoggerWrapper) Warning(args ...any) { 55 l.Logger.Print(args...) 56 } 57 58 // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. 59 func (l *LoggerWrapper) Warningln(args ...any) { 60 l.Logger.Println(args...) 61 } 62 63 // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. 64 func (l *LoggerWrapper) Warningf(format string, args ...any) { 65 l.Logger.Printf(format, args...) 66 } 67 68 // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. 69 func (l *LoggerWrapper) Error(args ...any) { 70 l.Logger.Print(args...) 71 } 72 73 // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. 74 func (l *LoggerWrapper) Errorln(args ...any) { 75 l.Logger.Println(args...) 76 } 77 78 // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. 79 func (l *LoggerWrapper) Errorf(format string, args ...any) { 80 l.Logger.Printf(format, args...) 81 } 82 83 // V reports whether verbosity level l is at least the requested verbose level. 84 func (*LoggerWrapper) V(int) bool { 85 // Returns true for all verbose level. 86 return true 87 }