RFC: Custom logger on the start server #3286
zrosenbauer
started this conversation in
RFCs
Replies: 1 comment 2 replies
-
@tannerlinsley @schiller-manuel I'm happy to take stab at this on my end... just want to make sure primary maintainers are on board. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Currently all of the server-side logging is done via good ole'
console
but I'd like to be able to use a dedicated logger across the board. This would allow developers to hook into logging tools because the logs need to follow a certain format. If we are unable to do this I would be unable to create metrics etc.Solution
Provide a way for developers to inject a logger of their choice, such as
pino
orbunyan
.Note
There is already some-level of support via the middleware https://tanstack.com/start/latest/docs/framework/react/middleware
API
I'm proposing to mirror the API from Fastify (https://fastify.dev/docs/latest/Reference/Server/#loggerinstance) as it's well defined.
Polyfill / Example
I created a quick polyfill to test it out.
Output:

LOE
I'm not a 100% sure on the level of effort, but a quick search in VS Code under the
packages/start-*
dirs, I found 78 results across 29 files that include the textconsole.
.I don't believe ALL of these would need or should be migrated as some could be client-side, others could be migrated later just probably need to include the primary paths.
Questions
console.log
Beta Was this translation helpful? Give feedback.
All reactions