diff --git a/pkg/log/log.go b/pkg/log/log.go index 962a0ee5b66c1719687443d74fa64a01aa786fac..bb34948efdead28fce58c5a6211bdb547c8be042 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -4,6 +4,7 @@ import ( "time" pb "git.perx.ru/perxis/perxis-go/proto/log" + "github.com/mitchellh/mapstructure" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -81,3 +82,9 @@ func EntryFromPB(request *pb.LogEntry) *Entry { Tags: request.Tags, } } + +func (e *Entry) ToMap() map[string]string { + res := make(map[string]string) + mapstructure.Decode(e, &res) + return res +}