3 * Copyright 2015 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 glogger defines glog-based logging for grpc.
20 // Importing this package will install glog as the logger used by grpclog.
26 "github.com/golang/glog"
27 "google.golang.org/grpc/grpclog"
31 grpclog.SetLoggerV2(&glogger{})
36 func (g *glogger) Info(args ...interface{}) {
37 glog.InfoDepth(2, args...)
40 func (g *glogger) Infoln(args ...interface{}) {
41 glog.InfoDepth(2, fmt.Sprintln(args...))
44 func (g *glogger) Infof(format string, args ...interface{}) {
45 glog.InfoDepth(2, fmt.Sprintf(format, args...))
48 func (g *glogger) Warning(args ...interface{}) {
49 glog.WarningDepth(2, args...)
52 func (g *glogger) Warningln(args ...interface{}) {
53 glog.WarningDepth(2, fmt.Sprintln(args...))
56 func (g *glogger) Warningf(format string, args ...interface{}) {
57 glog.WarningDepth(2, fmt.Sprintf(format, args...))
60 func (g *glogger) Error(args ...interface{}) {
61 glog.ErrorDepth(2, args...)
64 func (g *glogger) Errorln(args ...interface{}) {
65 glog.ErrorDepth(2, fmt.Sprintln(args...))
68 func (g *glogger) Errorf(format string, args ...interface{}) {
69 glog.ErrorDepth(2, fmt.Sprintf(format, args...))
72 func (g *glogger) Fatal(args ...interface{}) {
73 glog.FatalDepth(2, args...)
76 func (g *glogger) Fatalln(args ...interface{}) {
77 glog.FatalDepth(2, fmt.Sprintln(args...))
80 func (g *glogger) Fatalf(format string, args ...interface{}) {
81 glog.FatalDepth(2, fmt.Sprintf(format, args...))
84 func (g *glogger) V(l int) bool {
85 return bool(glog.V(glog.Level(l)))