-
Notifications
You must be signed in to change notification settings - Fork 212
Investigate textPayload population and double-quoting in logger #697
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
Comments
@sk- I believe this is working as intended...ish...in that Can you describe how you have your metrics set up now so I can think through how we might be able to make |
Thanks @mbleigh for looking into this. I tested again, and you are right, if you only have the However, the log docs, don't mention anything about this special case. Some of our metrics, just perform a query on This means that if a developer inadvertently converts a log from: console.warn(`Got unexpected ${id}`) to something like console.warn(`Got unexpected ${id}`, {extra_data: 1, id: 23}) then those logs won't be captured by the metric, unless I change it to read from both It'd be great if I also think that maybe compat should not accept structured data, because of 3 issues:
|
So (3) is definitely intended -- Node 8 is able to do multi-line output as a single entry, it's actually Node 10 that broke this behavior. If you want the behavior of every newline being a separate entry, you don't need to use the new logging API you can just use I think (1) is a good point -- but have you tested this? I believe the code is testing for plain objects before treating it as structured data. An error might behave appropriately, but I'd need to double-check. (2) is also a good point, and I think it might be reasonable to treat the I'll hold off on releasing the new logging API until I've had a little more time to talk with folks internally about the points you've raised here. |
You are right about 1). I missed the constructor check, which for the case of With respect to 3) I agree that is much better, but if you use compat then you don't have an alternative, other than manually splitting the entry. Note that I prefer this behavior, but may be surprising for someone using compat. Maybe in the notes, you could add a warning. |
If I could chime in here are about (2) I would agree that it would be most reasonable for compat to never do structured data - for me the compat stuff should be for people just wanting their old console.log stuff to go back to working like it did on node 8. If they want structured logging they should use the logging sdk. I.e. go for less magic. And I do agree that stuff like My game plan here for our firebase functions code would be: use compat for now so our existing stuff works again; for new functions make sure to use the logging SDK; eventually circle back and change everything to the new shiny structured logging (an easier(er) sell once everyone sees how good the new logs look). |
Oh, and if it wasn't obvious, I do still think that (3) is rightly "as intended" and should be a basic functionality/requirement of compat - make multiline logs come out at as single line. This is just to restore the pre node 10 funtionality. Anyone wanting them to come out as multiple log entries should not use compat. |
This has been released in |
Hey everyone :) Does the logs in the emulator maybe differ from those in the cloud environment. Thanks in advance for any help! |
See comments in #665.
The text was updated successfully, but these errors were encountered: