github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/log.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/log.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  type RegisterLoggerArg struct {
    13  	SessionID int      `codec:"sessionID" json:"sessionID"`
    14  	Name      string   `codec:"name" json:"name"`
    15  	Level     LogLevel `codec:"level" json:"level"`
    16  }
    17  
    18  type PerfLogPointArg struct {
    19  	SessionID int    `codec:"sessionID" json:"sessionID"`
    20  	Msg       string `codec:"msg" json:"msg"`
    21  }
    22  
    23  type LogInterface interface {
    24  	RegisterLogger(context.Context, RegisterLoggerArg) error
    25  	PerfLogPoint(context.Context, PerfLogPointArg) error
    26  }
    27  
    28  func LogProtocol(i LogInterface) rpc.Protocol {
    29  	return rpc.Protocol{
    30  		Name: "keybase.1.log",
    31  		Methods: map[string]rpc.ServeHandlerDescription{
    32  			"registerLogger": {
    33  				MakeArg: func() interface{} {
    34  					var ret [1]RegisterLoggerArg
    35  					return &ret
    36  				},
    37  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    38  					typedArgs, ok := args.(*[1]RegisterLoggerArg)
    39  					if !ok {
    40  						err = rpc.NewTypeError((*[1]RegisterLoggerArg)(nil), args)
    41  						return
    42  					}
    43  					err = i.RegisterLogger(ctx, typedArgs[0])
    44  					return
    45  				},
    46  			},
    47  			"perfLogPoint": {
    48  				MakeArg: func() interface{} {
    49  					var ret [1]PerfLogPointArg
    50  					return &ret
    51  				},
    52  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    53  					typedArgs, ok := args.(*[1]PerfLogPointArg)
    54  					if !ok {
    55  						err = rpc.NewTypeError((*[1]PerfLogPointArg)(nil), args)
    56  						return
    57  					}
    58  					err = i.PerfLogPoint(ctx, typedArgs[0])
    59  					return
    60  				},
    61  			},
    62  		},
    63  	}
    64  }
    65  
    66  type LogClient struct {
    67  	Cli rpc.GenericClient
    68  }
    69  
    70  func (c LogClient) RegisterLogger(ctx context.Context, __arg RegisterLoggerArg) (err error) {
    71  	err = c.Cli.Call(ctx, "keybase.1.log.registerLogger", []interface{}{__arg}, nil, 0*time.Millisecond)
    72  	return
    73  }
    74  
    75  func (c LogClient) PerfLogPoint(ctx context.Context, __arg PerfLogPointArg) (err error) {
    76  	err = c.Cli.Call(ctx, "keybase.1.log.perfLogPoint", []interface{}{__arg}, nil, 0*time.Millisecond)
    77  	return
    78  }