OSDN Git Service

new repo
[bytom/vapor.git] / vendor / google.golang.org / grpc / grpclog / glogger / glogger.go
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 glogger defines glog-based logging for grpc.
20 // Importing this package will install glog as the logger used by grpclog.
21 package glogger
22
23 import (
24         "fmt"
25
26         "github.com/golang/glog"
27         "google.golang.org/grpc/grpclog"
28 )
29
30 func init() {
31         grpclog.SetLoggerV2(&glogger{})
32 }
33
34 type glogger struct{}
35
36 func (g *glogger) Info(args ...interface{}) {
37         glog.InfoDepth(2, args...)
38 }
39
40 func (g *glogger) Infoln(args ...interface{}) {
41         glog.InfoDepth(2, fmt.Sprintln(args...))
42 }
43
44 func (g *glogger) Infof(format string, args ...interface{}) {
45         glog.InfoDepth(2, fmt.Sprintf(format, args...))
46 }
47
48 func (g *glogger) Warning(args ...interface{}) {
49         glog.WarningDepth(2, args...)
50 }
51
52 func (g *glogger) Warningln(args ...interface{}) {
53         glog.WarningDepth(2, fmt.Sprintln(args...))
54 }
55
56 func (g *glogger) Warningf(format string, args ...interface{}) {
57         glog.WarningDepth(2, fmt.Sprintf(format, args...))
58 }
59
60 func (g *glogger) Error(args ...interface{}) {
61         glog.ErrorDepth(2, args...)
62 }
63
64 func (g *glogger) Errorln(args ...interface{}) {
65         glog.ErrorDepth(2, fmt.Sprintln(args...))
66 }
67
68 func (g *glogger) Errorf(format string, args ...interface{}) {
69         glog.ErrorDepth(2, fmt.Sprintf(format, args...))
70 }
71
72 func (g *glogger) Fatal(args ...interface{}) {
73         glog.FatalDepth(2, args...)
74 }
75
76 func (g *glogger) Fatalln(args ...interface{}) {
77         glog.FatalDepth(2, fmt.Sprintln(args...))
78 }
79
80 func (g *glogger) Fatalf(format string, args ...interface{}) {
81         glog.FatalDepth(2, fmt.Sprintf(format, args...))
82 }
83
84 func (g *glogger) V(l int) bool {
85         return bool(glog.V(glog.Level(l)))
86 }