From 8fde14a2a35218c4beafb48b299555fe46242b5d Mon Sep 17 00:00:00 2001 From: surajgour-d11 Date: Sun, 16 Mar 2025 12:31:05 +0530 Subject: [PATCH] feat: add logs command Signed-off-by: surajgour-d11 --- cmd/logs/logs.go | 54 +++ internal/service/logs.go | 36 ++ main.go | 1 + proto/dream11/od/logs/v1/logs.proto | 25 ++ proto/gen/go/dream11/od/logs/v1/logs.pb.go | 336 ++++++++++++++++++ .../gen/go/dream11/od/logs/v1/logs_grpc.pb.go | 136 +++++++ 6 files changed, 588 insertions(+) create mode 100644 cmd/logs/logs.go create mode 100644 internal/service/logs.go create mode 100644 proto/dream11/od/logs/v1/logs.proto create mode 100644 proto/gen/go/dream11/od/logs/v1/logs.pb.go create mode 100644 proto/gen/go/dream11/od/logs/v1/logs_grpc.pb.go diff --git a/cmd/logs/logs.go b/cmd/logs/logs.go new file mode 100644 index 00000000..ce72be9c --- /dev/null +++ b/cmd/logs/logs.go @@ -0,0 +1,54 @@ +package logs + +import ( + "github.com/dream11/odin/cmd" + "github.com/dream11/odin/internal/service" + logs "github.com/dream11/odin/proto/gen/go/dream11/od/logs/v1" + logger "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +var traceID string +var follow bool +var serviceName string +var componentName string +var logsClient = service.Logs{} + +var logsCmd = &cobra.Command{ + Use: "logs", + Short: "Get Logs", + Long: `Get logs for a trace id`, + Run: func(cmd *cobra.Command, args []string) { + execute(cmd) + }, +} + +func init() { + logsCmd.Flags().StringVarP(&traceID, "trace-id", "t", "", "trace id") + logsCmd.Flags().BoolVarP(&follow, "follow", "f", false, "follow logs") + logsCmd.Flags().StringVar(&serviceName, "service", "", "service name") + logsCmd.Flags().StringVar(&serviceName, "component", "", "component name") + cmd.RootCmd.AddCommand(logsCmd) +} + +func execute(cmd *cobra.Command) { + ctx := cmd.Context() + // Check traceid should be present + if traceID == "" { + logger.Error("TraceID is required") + err := cmd.Help() + if err != nil { + return + } + } else { + err := logsClient.GetLogs(&ctx, &logs.GetLogsRequest{ + TraceId: traceID, + Follow: &follow, + ServiceName: &serviceName, + ComponentName: &componentName, + }) + if err != nil { + logger.Fatal("Failed to get logs ", err) + } + } +} diff --git a/internal/service/logs.go b/internal/service/logs.go new file mode 100644 index 00000000..0254b41f --- /dev/null +++ b/internal/service/logs.go @@ -0,0 +1,36 @@ +package service + +import ( + "context" + "fmt" + + logs "github.com/dream11/odin/proto/gen/go/dream11/od/logs/v1" +) + +// Logs performs operation on logs like get logs +type Logs struct{} + +// GetLogs Get logs +func (l *Logs) GetLogs(ctx *context.Context, request *logs.GetLogsRequest) error { + // Get logs + conn, requestCtx, err := grpcClient(ctx) + if err != nil { + return err + } + client := logs.NewLogsServiceClient(conn) + stream, err := client.GetLogs(*requestCtx, request) + if err != nil { + return err + } + for { + response, err := stream.Recv() + if err != nil { + break + } + // Print logs + for _, logMessage := range response.Logs { + fmt.Print(logMessage.Message) + } + } + return nil +} diff --git a/main.go b/main.go index 6f3fb032..4efab5ad 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ import ( _ "github.com/dream11/odin/cmd/deploy" _ "github.com/dream11/odin/cmd/describe" _ "github.com/dream11/odin/cmd/list" + _ "github.com/dream11/odin/cmd/logs" _ "github.com/dream11/odin/cmd/operate" _ "github.com/dream11/odin/cmd/release" _ "github.com/dream11/odin/cmd/set" diff --git a/proto/dream11/od/logs/v1/logs.proto b/proto/dream11/od/logs/v1/logs.proto new file mode 100644 index 00000000..0a80614f --- /dev/null +++ b/proto/dream11/od/logs/v1/logs.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package dream11.od.logs.v1; + +option go_package = "github.com/dream11/odin/proto/gen/go/dream11/od/logs/v1"; + +service LogsService { + rpc GetLogs(GetLogsRequest) returns (stream GetLogsResponse) {} +} + +message GetLogsRequest { + string trace_id = 1; + optional bool follow = 2; + optional string service_name = 3; + optional string component_name = 4; +} + +message GetLogsResponse { + repeated Log logs = 1; +} + +message Log { + string message = 1; + string level = 2; + string timestamp = 3; +} diff --git a/proto/gen/go/dream11/od/logs/v1/logs.pb.go b/proto/gen/go/dream11/od/logs/v1/logs.pb.go new file mode 100644 index 00000000..59f98eaa --- /dev/null +++ b/proto/gen/go/dream11/od/logs/v1/logs.pb.go @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v5.29.3 +// source: dream11/od/logs/v1/logs.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetLogsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + Follow *bool `protobuf:"varint,2,opt,name=follow,proto3,oneof" json:"follow,omitempty"` + ServiceName *string `protobuf:"bytes,3,opt,name=service_name,json=serviceName,proto3,oneof" json:"service_name,omitempty"` + ComponentName *string `protobuf:"bytes,4,opt,name=component_name,json=componentName,proto3,oneof" json:"component_name,omitempty"` +} + +func (x *GetLogsRequest) Reset() { + *x = GetLogsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_dream11_od_logs_v1_logs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLogsRequest) ProtoMessage() {} + +func (x *GetLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_dream11_od_logs_v1_logs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLogsRequest.ProtoReflect.Descriptor instead. +func (*GetLogsRequest) Descriptor() ([]byte, []int) { + return file_dream11_od_logs_v1_logs_proto_rawDescGZIP(), []int{0} +} + +func (x *GetLogsRequest) GetTraceId() string { + if x != nil { + return x.TraceId + } + return "" +} + +func (x *GetLogsRequest) GetFollow() bool { + if x != nil && x.Follow != nil { + return *x.Follow + } + return false +} + +func (x *GetLogsRequest) GetServiceName() string { + if x != nil && x.ServiceName != nil { + return *x.ServiceName + } + return "" +} + +func (x *GetLogsRequest) GetComponentName() string { + if x != nil && x.ComponentName != nil { + return *x.ComponentName + } + return "" +} + +type GetLogsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Logs []*Log `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"` +} + +func (x *GetLogsResponse) Reset() { + *x = GetLogsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_dream11_od_logs_v1_logs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetLogsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLogsResponse) ProtoMessage() {} + +func (x *GetLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_dream11_od_logs_v1_logs_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLogsResponse.ProtoReflect.Descriptor instead. +func (*GetLogsResponse) Descriptor() ([]byte, []int) { + return file_dream11_od_logs_v1_logs_proto_rawDescGZIP(), []int{1} +} + +func (x *GetLogsResponse) GetLogs() []*Log { + if x != nil { + return x.Logs + } + return nil +} + +type Log struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"` + Timestamp string `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *Log) Reset() { + *x = Log{} + if protoimpl.UnsafeEnabled { + mi := &file_dream11_od_logs_v1_logs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Log) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Log) ProtoMessage() {} + +func (x *Log) ProtoReflect() protoreflect.Message { + mi := &file_dream11_od_logs_v1_logs_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Log.ProtoReflect.Descriptor instead. +func (*Log) Descriptor() ([]byte, []int) { + return file_dream11_od_logs_v1_logs_proto_rawDescGZIP(), []int{2} +} + +func (x *Log) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Log) GetLevel() string { + if x != nil { + return x.Level + } + return "" +} + +func (x *Log) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + +var File_dream11_od_logs_v1_logs_proto protoreflect.FileDescriptor + +var file_dream11_od_logs_v1_logs_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, 0x2f, 0x6c, 0x6f, 0x67, + 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x76, 0x31, 0x22, 0xcb, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, + 0x64, 0x12, 0x1b, 0x0a, 0x06, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x48, 0x00, 0x52, 0x06, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x88, 0x01, 0x01, 0x12, 0x26, + 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, + 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x42, 0x0f, 0x0a, + 0x0d, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x11, + 0x0a, 0x0f, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x22, 0x3e, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, + 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, + 0x73, 0x22, 0x53, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x32, 0x65, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x73, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x56, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73, + 0x12, 0x22, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, 0x64, 0x2e, 0x6c, 0x6f, + 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2e, 0x6f, + 0x64, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x39, 0x5a, + 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x72, 0x65, 0x61, + 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, 0x69, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x64, 0x72, 0x65, 0x61, 0x6d, 0x31, 0x31, 0x2f, 0x6f, 0x64, + 0x2f, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_dream11_od_logs_v1_logs_proto_rawDescOnce sync.Once + file_dream11_od_logs_v1_logs_proto_rawDescData = file_dream11_od_logs_v1_logs_proto_rawDesc +) + +func file_dream11_od_logs_v1_logs_proto_rawDescGZIP() []byte { + file_dream11_od_logs_v1_logs_proto_rawDescOnce.Do(func() { + file_dream11_od_logs_v1_logs_proto_rawDescData = protoimpl.X.CompressGZIP(file_dream11_od_logs_v1_logs_proto_rawDescData) + }) + return file_dream11_od_logs_v1_logs_proto_rawDescData +} + +var file_dream11_od_logs_v1_logs_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_dream11_od_logs_v1_logs_proto_goTypes = []interface{}{ + (*GetLogsRequest)(nil), // 0: dream11.od.logs.v1.GetLogsRequest + (*GetLogsResponse)(nil), // 1: dream11.od.logs.v1.GetLogsResponse + (*Log)(nil), // 2: dream11.od.logs.v1.Log +} +var file_dream11_od_logs_v1_logs_proto_depIdxs = []int32{ + 2, // 0: dream11.od.logs.v1.GetLogsResponse.logs:type_name -> dream11.od.logs.v1.Log + 0, // 1: dream11.od.logs.v1.LogsService.GetLogs:input_type -> dream11.od.logs.v1.GetLogsRequest + 1, // 2: dream11.od.logs.v1.LogsService.GetLogs:output_type -> dream11.od.logs.v1.GetLogsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_dream11_od_logs_v1_logs_proto_init() } +func file_dream11_od_logs_v1_logs_proto_init() { + if File_dream11_od_logs_v1_logs_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_dream11_od_logs_v1_logs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLogsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dream11_od_logs_v1_logs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetLogsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dream11_od_logs_v1_logs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Log); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_dream11_od_logs_v1_logs_proto_msgTypes[0].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_dream11_od_logs_v1_logs_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_dream11_od_logs_v1_logs_proto_goTypes, + DependencyIndexes: file_dream11_od_logs_v1_logs_proto_depIdxs, + MessageInfos: file_dream11_od_logs_v1_logs_proto_msgTypes, + }.Build() + File_dream11_od_logs_v1_logs_proto = out.File + file_dream11_od_logs_v1_logs_proto_rawDesc = nil + file_dream11_od_logs_v1_logs_proto_goTypes = nil + file_dream11_od_logs_v1_logs_proto_depIdxs = nil +} diff --git a/proto/gen/go/dream11/od/logs/v1/logs_grpc.pb.go b/proto/gen/go/dream11/od/logs/v1/logs_grpc.pb.go new file mode 100644 index 00000000..8169c75e --- /dev/null +++ b/proto/gen/go/dream11/od/logs/v1/logs_grpc.pb.go @@ -0,0 +1,136 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v5.29.3 +// source: dream11/od/logs/v1/logs.proto + +package v1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + LogsService_GetLogs_FullMethodName = "/dream11.od.logs.v1.LogsService/GetLogs" +) + +// LogsServiceClient is the client API for LogsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type LogsServiceClient interface { + GetLogs(ctx context.Context, in *GetLogsRequest, opts ...grpc.CallOption) (LogsService_GetLogsClient, error) +} + +type logsServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewLogsServiceClient(cc grpc.ClientConnInterface) LogsServiceClient { + return &logsServiceClient{cc} +} + +func (c *logsServiceClient) GetLogs(ctx context.Context, in *GetLogsRequest, opts ...grpc.CallOption) (LogsService_GetLogsClient, error) { + stream, err := c.cc.NewStream(ctx, &LogsService_ServiceDesc.Streams[0], LogsService_GetLogs_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &logsServiceGetLogsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type LogsService_GetLogsClient interface { + Recv() (*GetLogsResponse, error) + grpc.ClientStream +} + +type logsServiceGetLogsClient struct { + grpc.ClientStream +} + +func (x *logsServiceGetLogsClient) Recv() (*GetLogsResponse, error) { + m := new(GetLogsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// LogsServiceServer is the server API for LogsService service. +// All implementations must embed UnimplementedLogsServiceServer +// for forward compatibility +type LogsServiceServer interface { + GetLogs(*GetLogsRequest, LogsService_GetLogsServer) error + mustEmbedUnimplementedLogsServiceServer() +} + +// UnimplementedLogsServiceServer must be embedded to have forward compatible implementations. +type UnimplementedLogsServiceServer struct { +} + +func (UnimplementedLogsServiceServer) GetLogs(*GetLogsRequest, LogsService_GetLogsServer) error { + return status.Errorf(codes.Unimplemented, "method GetLogs not implemented") +} +func (UnimplementedLogsServiceServer) mustEmbedUnimplementedLogsServiceServer() {} + +// UnsafeLogsServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LogsServiceServer will +// result in compilation errors. +type UnsafeLogsServiceServer interface { + mustEmbedUnimplementedLogsServiceServer() +} + +func RegisterLogsServiceServer(s grpc.ServiceRegistrar, srv LogsServiceServer) { + s.RegisterService(&LogsService_ServiceDesc, srv) +} + +func _LogsService_GetLogs_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetLogsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(LogsServiceServer).GetLogs(m, &logsServiceGetLogsServer{stream}) +} + +type LogsService_GetLogsServer interface { + Send(*GetLogsResponse) error + grpc.ServerStream +} + +type logsServiceGetLogsServer struct { + grpc.ServerStream +} + +func (x *logsServiceGetLogsServer) Send(m *GetLogsResponse) error { + return x.ServerStream.SendMsg(m) +} + +// LogsService_ServiceDesc is the grpc.ServiceDesc for LogsService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LogsService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "dream11.od.logs.v1.LogsService", + HandlerType: (*LogsServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetLogs", + Handler: _LogsService_GetLogs_Handler, + ServerStreams: true, + }, + }, + Metadata: "dream11/od/logs/v1/logs.proto", +}