axiom + t3, how to log
I would like to use the req.log from next-axiom (see attached image) but I cant find req and res using t3. Any ideas on how to implement next-axiom into t3? https://github.com/axiomhq/next-axiom
GitHub
GitHub - axiomhq/next-axiom: The official Next.js library for Axiom.
The official Next.js library for Axiom. Contribute to axiomhq/next-axiom development by creating an account on GitHub.
16 Replies
GitHub
create-t3-app/base-context.ts at next · t3-oss/create-t3-app
The best way to start a full-stack, typesafe Next.js app - create-t3-app/base-context.ts at next · t3-oss/create-t3-app
on opts you have both req and resp
ok, so like this then ?
so that i can get the req in my actual code? i think i may be overcomplicating this
on the createInnerContext
you should pass only stuff that you need in the procedures
passing the whole request its not the best
you can try only using
import { log } from 'next-axiom';
to see if works
if not
thank you that worked 👍
GitHub
Usage with TRPC - how does this look? · Issue #64 · axiomhq/next-ax...
Hey, I'm building an application with the T3 stack and wanted to check if there is a better way to use Axiom with TRPC's router in a Next API route. Let me know if you see room for ...
fwiw I don't do this - I just rely on normal console logs coming through the vercel integration
yeah to be honest i realised i could just test it locally and i dont need axios at all :/
Axiom is useful for figuring out why things are breaking in production!
I leave lots of logs in our backend code
True, i may just keep it to keep an eye on my function duration. I feel like that will be what breaks first for me
where abouts is good practice to log would you say, i dont know if i should log all user events
There isn't really an established "best practices around logging". I try to imagine something is broken and think about what logs I would want if it was broken
And add those in if I can
Generally, before any important
await
or other promise, I try to log somethingsounds logical, thanks all 🙂
Sorry to ping you @nyx (Rustular DevRel) and @maxchurch, but could you please provide a complete code snippet on how to add the logger to the tRPC context. I cannot find any instructions on how to do this. Thank you so much 🙏