Middleware global logging examples
Hello! I was wondering if anybody has managed to produce reasonable logging for tanstack/start on the server? I cannot find any examples of logging request/response and the details of it.
request is always undefined (data coming in) and response is mostly just the serverFN response if there is one.
This is my middleware, but this doesn't really give me proper server logs and looking at the response of result it seems to be a lot of stuff we don't need.
I couldn't find any examples of just ending up with json logs like:
Or how to construct them based on the fact I don't seem to have anything coming in for the request. Has anybody managed to do something with this?1 Reply
ambitious-aqua•3mo ago
Hey! Been looking around for a while for this too and apparently there seems to be no way of doing this. I love having request logs in nextjs so would be awesome to have them here too
Found a solution, a bit hacky but better than nothing. Only shows requests that the server handles, not client-side navigation.
Just add this to your
vite.config.ts