diff --git a/logs/log.go b/logs/log.go index 39e6799926d19de0c2f1fe2f90e11e3de28a2531..2de45a30cd98bbd5ce840726b862dbca52fc8480 100644 --- a/logs/log.go +++ b/logs/log.go @@ -27,7 +27,7 @@ func (l Level) String() string { } type Entry struct { - ID string `json:"_id" bson:"_id" mapstructure:"_id"` + ID string `json:"id" bson:"_id" mapstructure:"id"` Timestamp time.Time `json:"timestamp,omitempty" bson:"timestamp,omitempty" mapstructure:"timestamp,omitempty"` Level Level `json:"level,omitempty" bson:"level,omitempty" mapstructure:"level,omitempty"` Message string `json:"message,omitempty" bson:"message,omitempty" mapstructure:"message,omitempty"` diff --git a/logs/log_test.go b/logs/log_test.go index 1816cb9ff8e9222784623acd87593c6ef0bb3acf..72c71f4e636b3f7e43a1108be151cff1d7d16482 100644 --- a/logs/log_test.go +++ b/logs/log_test.go @@ -42,7 +42,7 @@ func TestEntry_ToMap(t *testing.T) { nil, nil, }, - map[string]interface{}{"caller": map[string]interface{}{"type": "user", "user_id": "<user_id>"}, "caller_id": "/users/<user_id>", "category": "", "component": "", "event": "", "id": "1", "level": Level(0), "message": "message", "object": map[string]interface{}{"env_id": "<env_id>", "space_id": "<space_id>", "type": "environment"}, "object_id": "/spaces/<space_id>/envs/<env_id>", "timestamp": time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)}, + map[string]interface{}{"caller": map[string]interface{}{"type": "user", "user_id": "<user_id>"}, "caller_id": "/users/<user_id>", "category": "", "component": "", "event": "", "_id": "1", "level": Level(0), "message": "message", "object": map[string]interface{}{"env_id": "<env_id>", "space_id": "<space_id>", "type": "environment"}, "object_id": "/spaces/<space_id>/envs/<env_id>", "timestamp": time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)}, }, } for _, tt := range tests {