From 02d1a95fb0ac7f97de3dd5c3728401aa39dfc5c0 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Tue, 23 Jan 2024 18:02:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20convertInterfaceToAny?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/log/log.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/pkg/log/log.go b/pkg/log/log.go index 70ee05ee..728f88b2 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -1,15 +1,10 @@ package log import ( - "encoding/json" "time" pb "git.perx.ru/perxis/perxis-go/proto/log" - "github.com/golang/protobuf/ptypes/any" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/timestamppb" - wrappers "google.golang.org/protobuf/types/known/wrapperspb" ) type Level int @@ -44,15 +39,15 @@ type Entry struct { Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` } -func convertInterfaceToAny(v interface{}) (*any.Any, error) { - anyValue := &any.Any{} - bytes, _ := json.Marshal(v) - bytesValue := &wrappers.BytesValue{ - Value: bytes, - } - err := anypb.MarshalFrom(anyValue, bytesValue, proto.MarshalOptions{}) - return anyValue, err -} +//func convertInterfaceToAny(v interface{}) (*any.Any, error) { +// anyValue := &any.Any{} +// bytes, _ := json.Marshal(v) +// bytesValue := &wrappers.BytesValue{ +// Value: bytes, +// } +// err := anypb.MarshalFrom(anyValue, bytesValue, proto.MarshalOptions{}) +// return anyValue, err +//} func EntryToPB(entry *Entry) *pb.LogEntry { logEntry := &pb.LogEntry{ @@ -65,10 +60,9 @@ func EntryToPB(entry *Entry) *pb.LogEntry { Event: entry.Event, Object: entry.Object, Caller: entry.Caller, + Attr: nil, //implement Tags: entry.Tags, } - logEntry.Attr, _ = convertInterfaceToAny(entry.Attr) - return logEntry } -- GitLab