FEAT: Add logger compat module for v2 restoring fully v1 behavior when using standard console #1534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In firebase-functions v1 when using the standard
console
you'd visualize logs under cloud run with atraceId
.In v2 that behavior has gone, there's a module to patch the
console
but that method only makes console work again by adjusting the way it logs the user inserted messages.If we want to have the trace attached to each log emitted by a function we need to use the firebase logger module which is provided by firebase functions.
Since the logger compat module doesn't restore the behavior under v1, I've made an adaptation to ensure it works as expected and keeps the
traceId
.The code is a draft, I've added a
v2
folder inside thelogger
folder which I think is wrong but I've done so we can start discussing if this adjustment is possible and where it should go.