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