decode: s/type/decoder_msg_type
type is a really generally name. sometimes, it is used in other libraries or various output as a valid field name. let's not make it a reserved keyword that gets overriden by type == Kayvee
This commit is contained in:
parent
4b4af77ba2
commit
d1473f894a
2 changed files with 120 additions and 120 deletions
|
|
@ -15,7 +15,7 @@ import (
|
|||
var reservedFields = []string{
|
||||
"prefix",
|
||||
"postfix",
|
||||
"Type",
|
||||
"decoder_msg_type",
|
||||
}
|
||||
|
||||
func stringInSlice(s string, slice []string) bool {
|
||||
|
|
@ -97,7 +97,7 @@ func FieldsFromKayvee(line string) (map[string]interface{}, error) {
|
|||
}
|
||||
}
|
||||
|
||||
m["type"] = "Kayvee"
|
||||
m["decoder_msg_type"] = "Kayvee"
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func TestKayveeDecoding(t *testing.T) {
|
|||
"prefix": "",
|
||||
"postfix": "",
|
||||
"a": "b",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
},
|
||||
ExpectedError: nil,
|
||||
},
|
||||
|
|
@ -38,7 +38,7 @@ func TestKayveeDecoding(t *testing.T) {
|
|||
"prefix": "prefix ",
|
||||
"postfix": "",
|
||||
"a": "b",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
},
|
||||
ExpectedError: nil,
|
||||
},
|
||||
|
|
@ -49,7 +49,7 @@ func TestKayveeDecoding(t *testing.T) {
|
|||
"prefix": "",
|
||||
"postfix": " postfix",
|
||||
"a": "b",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
},
|
||||
ExpectedError: nil,
|
||||
},
|
||||
|
|
@ -60,7 +60,7 @@ func TestKayveeDecoding(t *testing.T) {
|
|||
"prefix": "prefix ",
|
||||
"postfix": " postfix",
|
||||
"a": "b",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
},
|
||||
ExpectedError: nil,
|
||||
},
|
||||
|
|
@ -226,7 +226,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished"}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -245,7 +245,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished","container_app":"force-app"}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -285,7 +285,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished", "nested": {"a":"b"}}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -308,7 +308,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished", "nested": {"a":"b"}}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -331,7 +331,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished", "nested": [{"a":"b"}]}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -354,7 +354,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished", "_source": "a"}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -388,7 +388,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished", "_source": "a"}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
@ -412,7 +412,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished", "_source": "a"}`,
|
||||
"title": "request_finished",
|
||||
"type": "Kayvee",
|
||||
"decoder_msg_type": "Kayvee",
|
||||
"prefix": "2017/04/05 21:57:46 some_file.go:10: ",
|
||||
"postfix": "",
|
||||
"env": "deploy-env",
|
||||
|
|
|
|||
Loading…
Reference in a new issue