diff options
Diffstat (limited to 'vendor/google.golang.org/grpc/grpclog/logger.go')
-rw-r--r-- | vendor/google.golang.org/grpc/grpclog/logger.go | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go new file mode 100644 index 0000000..d03b239 --- /dev/null +++ b/vendor/google.golang.org/grpc/grpclog/logger.go | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright 2015 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 grpclog | ||
20 | |||
21 | // Logger mimics golang's standard Logger as an interface. | ||
22 | // Deprecated: use LoggerV2. | ||
23 | type Logger interface { | ||
24 | Fatal(args ...interface{}) | ||
25 | Fatalf(format string, args ...interface{}) | ||
26 | Fatalln(args ...interface{}) | ||
27 | Print(args ...interface{}) | ||
28 | Printf(format string, args ...interface{}) | ||
29 | Println(args ...interface{}) | ||
30 | } | ||
31 | |||
32 | // SetLogger sets the logger that is used in grpc. Call only from | ||
33 | // init() functions. | ||
34 | // Deprecated: use SetLoggerV2. | ||
35 | func SetLogger(l Logger) { | ||
36 | logger = &loggerWrapper{Logger: l} | ||
37 | } | ||
38 | |||
39 | // loggerWrapper wraps Logger into a LoggerV2. | ||
40 | type loggerWrapper struct { | ||
41 | Logger | ||
42 | } | ||
43 | |||
44 | func (g *loggerWrapper) Info(args ...interface{}) { | ||
45 | g.Logger.Print(args...) | ||
46 | } | ||
47 | |||
48 | func (g *loggerWrapper) Infoln(args ...interface{}) { | ||
49 | g.Logger.Println(args...) | ||
50 | } | ||
51 | |||
52 | func (g *loggerWrapper) Infof(format string, args ...interface{}) { | ||
53 | g.Logger.Printf(format, args...) | ||
54 | } | ||
55 | |||
56 | func (g *loggerWrapper) Warning(args ...interface{}) { | ||
57 | g.Logger.Print(args...) | ||
58 | } | ||
59 | |||
60 | func (g *loggerWrapper) Warningln(args ...interface{}) { | ||
61 | g.Logger.Println(args...) | ||
62 | } | ||
63 | |||
64 | func (g *loggerWrapper) Warningf(format string, args ...interface{}) { | ||
65 | g.Logger.Printf(format, args...) | ||
66 | } | ||
67 | |||
68 | func (g *loggerWrapper) Error(args ...interface{}) { | ||
69 | g.Logger.Print(args...) | ||
70 | } | ||
71 | |||
72 | func (g *loggerWrapper) Errorln(args ...interface{}) { | ||
73 | g.Logger.Println(args...) | ||
74 | } | ||
75 | |||
76 | func (g *loggerWrapper) Errorf(format string, args ...interface{}) { | ||
77 | g.Logger.Printf(format, args...) | ||
78 | } | ||
79 | |||
80 | func (g *loggerWrapper) V(l int) bool { | ||
81 | // Returns true for all verbose level. | ||
82 | return true | ||
83 | } | ||