-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
rpc_adapter.go
97 lines (72 loc) · 2.46 KB
/
rpc_adapter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright 2016 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package logger
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
"golang.org/x/net/context"
)
// RPCLoggerAdapter is used to turn a logger complying to the rpc.LogOutput interface
// into one that can be used as a logger.Logger
type RPCLoggerAdapter struct {
log rpc.LogOutput
}
func NewRPCLoggerAdapter(log rpc.LogOutput) Logger {
return RPCLoggerAdapter{
log: log,
}
}
func (l RPCLoggerAdapter) Debug(format string, args ...interface{}) {
l.log.Debug(format, args)
}
func (l RPCLoggerAdapter) CDebugf(_ context.Context, format string, args ...interface{}) {
l.log.Debug(format, args)
}
func (l RPCLoggerAdapter) Info(format string, args ...interface{}) {
l.log.Info(format, args)
}
func (l RPCLoggerAdapter) CInfof(_ context.Context, format string, args ...interface{}) {
l.log.Info(format, args)
}
func (l RPCLoggerAdapter) Notice(format string, args ...interface{}) {
l.log.Warning(format, args)
}
func (l RPCLoggerAdapter) CNoticef(_ context.Context, format string, args ...interface{}) {
l.log.Warning(format, args)
}
func (l RPCLoggerAdapter) Warning(format string, args ...interface{}) {
l.log.Warning(format, args)
}
func (l RPCLoggerAdapter) CWarningf(_ context.Context, format string, args ...interface{}) {
l.log.Warning(format, args)
}
func (l RPCLoggerAdapter) Error(format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) Errorf(format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) CErrorf(_ context.Context, format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) Critical(format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) CCriticalf(_ context.Context, format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) Fatalf(format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) CFatalf(_ context.Context, format string, args ...interface{}) {
l.log.Error(format, args)
}
func (l RPCLoggerAdapter) Profile(format string, args ...interface{}) {
l.log.Profile(format, args)
}
func (l RPCLoggerAdapter) Configure(style string, debug bool, filename string) {
}
func (l RPCLoggerAdapter) CloneWithAddedDepth(depth int) Logger {
return l
}
func (l RPCLoggerAdapter) SetExternalHandler(handler ExternalHandler) {
}