Skip to content

Commit

Permalink
Make entry.Entry smaller by reordeing fields (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek-sumo authored Apr 12, 2021
1 parent fff939c commit 1c609c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions entry/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ var now = getNow()
// Entry is a flexible representation of log data associated with a timestamp.
type Entry struct {
Timestamp time.Time `json:"timestamp" yaml:"timestamp"`
Severity Severity `json:"severity" yaml:"severity"`
SeverityText string `json:"severity_text,omitempty" yaml:"severity_text,omitempty"`
Body interface{} `json:"body" yaml:"body"`
Attributes map[string]string `json:"attributes,omitempty" yaml:"attributes,omitempty"`
Resource map[string]string `json:"resource,omitempty" yaml:"resource,omitempty"`
Body interface{} `json:"body" yaml:"body"`
TraceId []byte `json:"trace_id,omitempty" yaml:"trace_id,omitempty"`
SeverityText string `json:"severity_text,omitempty" yaml:"severity_text,omitempty"`
SpanId []byte `json:"span_id,omitempty" yaml:"span_id,omitempty"`
TraceId []byte `json:"trace_id,omitempty" yaml:"trace_id,omitempty"`
TraceFlags []byte `json:"trace_flags,omitempty" yaml:"trace_flags,omitempty"`
Severity Severity `json:"severity" yaml:"severity"`
}

// New will create a new log entry with current timestamp and an empty body.
Expand Down
2 changes: 1 addition & 1 deletion operator/builtin/output/stdout/stdout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ func TestStdoutOperator(t *testing.T) {
marshalledTimestamp, err := json.Marshal(ts)
require.NoError(t, err)

expected := `{"timestamp":` + string(marshalledTimestamp) + `,"severity":0,"body":"test body"}` + "\n"
expected := `{"timestamp":` + string(marshalledTimestamp) + `,"body":"test body","severity":0}` + "\n"
require.Equal(t, expected, buf.String())
}

0 comments on commit 1c609c8

Please sign in to comment.