Closed felangel closed 1 year ago
gah! this is tricky.
Before this change EVERY message is encoded with toString
with this change all messages are encoded with jsonEncode
. Which might cause failures in a bunch of unexpected cases.
I wonder if we should add a JsonMessage
wrapper type that we can test against? See where I'm going?
gah! this is tricky.
Before this change EVERY message is encoded with
toString
with this change all messages are encoded withjsonEncode
. Which might cause failures in a bunch of unexpected cases.I wonder if we should add a
JsonMessage
wrapper type that we can test against? See where I'm going?
Just to make sure I understand, you're suggesting introducing a JsonMessage
class that developers will need to explicitly wrap their messages in like:
log(JsonMessage({'hello': 'world'}));
Is that correct?
@felangel – suggesting/brainstorming/etc – yeah. Thoughts?
@kevmoo what are your thoughts on checking if the message is json encodable and defaulting to string if not? Would that be too expensive of an operation?
@kevmoo what are your thoughts on checking if the message is json encodable and defaulting to string if not? Would that be too expensive of an operation?
I guess we could just test is Map
. Should be fine. A tiny bit hacky, but I doubt it'd break anyone.
@kevmoo what are your thoughts on checking if the message is json encodable and defaulting to string if not? Would that be too expensive of an operation?
I guess we could just test
is Map
. Should be fine. A tiny bit hacky, but I doubt it'd break anyone.
@kevmoo updated the PR lmk what you think?
@felangel – now the nits.
cloudLoggingMiddleware
) explaining this behavior?@felangel – now the nits.
- [ ] test
- [ ] changelog entry
- [ ] Likely want to include some doc comments (maybe on
cloudLoggingMiddleware
) explaining this behavior?
Sounds great, I didn't see any tests for log
but happy to try to add some from scratch.
@felangel – crap. If there is no testing, we should leave it for now. Plumbing through the right logic there is more work than you should have to do...
@felangel – crap. If there is no testing, we should leave it for now. Plumbing through the right logic there is more work than you should have to do...
@kevmoo sounds good, I updated api docs and CHANGELOG lmk if there's anything else you want me to do.
You're going to have to rebase, now. 😁
@kevmoo, just rebased on main 👍
Closes #394
Currently, log messages do not get interpreted as jsonPayload even if a JSON object is provided:
results in:
This change results in the following log:
Are there existing tests for the logger? I looked but wasn't able to find any.