-
Notifications
You must be signed in to change notification settings - Fork 34
Handle both object and string LogEventRecord types in json Unmarshal #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
astorm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Does the thing, has tests, looks great.
| require ( | ||
| github.com/google/go-cmp v0.5.6 // indirect | ||
| github.com/pkg/errors v0.9.1 | ||
| github.com/stretchr/testify v1.7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting the introduction of a new third party dependency. Project seems well represented by GitHub stars and has a number of tutorials written about it. 👍
| @@ -1,8 +1,19 @@ | |||
| github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presuming these all come from the inclusion of stretchr/testify 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
The Logs API can set either a string or an object value for the log event
recordfield so we need to handle that when unmarshalling the json.object value:
{ "time": "2021-10-20T08:13:03.278Z", "type": "platform.end", "record": { "requestId": "61c0fdeb-f013-4f2a-b627-56278f5666b8" } }string value:
{ "time": "2021-10-20T08:13:03.278Z", "type": "platform.fault", "record": "Unknown application error occurred\nFunction<Exception>\n" }Resolves #54