Skip to content
Snippets Groups Projects
Commit 3dd4cdb8 authored by ko_oler's avatar ko_oler
Browse files

правки в EntryToPB и EntryFromPB

parent 46b4defc
No related branches found
No related tags found
No related merge requests found
...@@ -59,18 +59,21 @@ func EntryToPB(entry *Entry) *pb.LogEntry { ...@@ -59,18 +59,21 @@ func EntryToPB(entry *Entry) *pb.LogEntry {
Category: entry.Category, Category: entry.Category,
Component: entry.Component, Component: entry.Component,
Event: entry.Event, Event: entry.Event,
ObjectId: entry.ObjectID.String(),
CallerId: entry.CallerID.String(),
Attr: nil, //implement Attr: nil, //implement
Tags: entry.Tags, Tags: entry.Tags,
} }
if entry.ObjectID != nil {
logEntry.ObjectId = entry.ObjectID.String()
}
if entry.CallerID != nil {
logEntry.CallerId = entry.CallerID.String()
}
return logEntry return logEntry
} }
func EntryFromPB(request *pb.LogEntry) *Entry { func EntryFromPB(request *pb.LogEntry) *Entry {
objectID, _ := id.Parse(request.ObjectId) logEntry := &Entry{
callerID, _ := id.Parse(request.CallerId)
return &Entry{
ID: request.Id, ID: request.Id,
Timestamp: request.Timestamp.AsTime(), Timestamp: request.Timestamp.AsTime(),
LogLevel: Level(request.Level), LogLevel: Level(request.Level),
...@@ -78,11 +81,18 @@ func EntryFromPB(request *pb.LogEntry) *Entry { ...@@ -78,11 +81,18 @@ func EntryFromPB(request *pb.LogEntry) *Entry {
Category: request.Category, Category: request.Category,
Component: request.Component, Component: request.Component,
Event: request.Event, Event: request.Event,
ObjectID: objectID,
CallerID: callerID,
Attr: request.Attr, // todo: как с этим работать? Attr: request.Attr, // todo: как с этим работать?
Tags: request.Tags, Tags: request.Tags,
} }
if request.ObjectId != "" {
logEntry.ObjectID, _ = id.Parse(request.ObjectId)
}
if request.CallerId != "" {
logEntry.CallerID, _ = id.Parse(request.CallerId)
}
return logEntry
} }
func (e *Entry) ToMap() map[string]any { func (e *Entry) ToMap() map[string]any {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment