You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to create a new patch for process.stdout.write but realized that Pino also uses the same method underneath by default (I believed it is this code). Even though during the testing this recursive calling loop seems to work, but the output is not as expected, i.e. the whole JSON format message is wrapped in the msg field, instead of itself being the output.
One potential hacky workaround is to check the caller and decide whether we need to patch the call or not, but Function.prototype.caller is deprecated due to security risks, so this doesn't seem to be a viable path.
I wonder if there are any other solutions, or it just can't be solved.
The text was updated successfully, but these errors were encountered:
Patch-package next itself would probably work. Maybe a postinstall that does a sort-of search and replace - Biome.js uses a nifty library for doing search-and-replace type commands.
Although it's probably just as easy to get a PR merged into core, which allows for doing these logging things.
Lastly, sentry has a fine logging solution for next, so they will certainly have a solution on their sdk.
Starting from Next 14.2.0, Next will output request logs in dev mode (vercel/next.js#62946), which is always enabled and uses
process.stdout.write
to output the logs.I tried to create a new patch for
process.stdout.write
but realized that Pino also uses the same method underneath by default (I believed it is this code). Even though during the testing this recursive calling loop seems to work, but the output is not as expected, i.e. the whole JSON format message is wrapped in themsg
field, instead of itself being the output.One potential hacky workaround is to check the caller and decide whether we need to patch the call or not, but Function.prototype.caller is deprecated due to security risks, so this doesn't seem to be a viable path.
I wonder if there are any other solutions, or it just can't be solved.
The text was updated successfully, but these errors were encountered: