axiomhq/next-axiom

withAxiom() route wrapper doesn't parse fields

Closed this issue · 3 comments

export const POST = withAxiom(async (req: AxiomRequest) => {
  const ENDPOINT_LOGGER = req.log.with({
    endpoint: {
      route: "/api/dashboard",
      method: "POST",
      searchParams: req.nextUrl.searchParams.toString(),
    },
  });
  
  ENDPOINT_LOGGER.info("test");
...
}

When wrapping my route handlers with withAxiom(), I would expect for the args (endpoint.route, etc.) to be their own fields within Axiom. However, the args seem to be being parsed as part of the message (instead of being split into their own field).

Hey @rajdtta, that's the console output for preview/development environments, picked up by the log sink. On production this should be sent to Axiom directly. What environment are you seeing this on?

Hey @rajdtta, that's the console output for preview/development environments, picked up by the log sink. On production this should be sent to Axiom directly. What environment are you seeing this on?

Sorry, just seeing this now. This is indeed on a development / preview environment

If you want these logs to get sent to preview/development environments, you can update the environments NEXT_PUBLIC_AXIOM_INGEST_ENDPOINT is enabled in.

Closing here, feel free to reopen if the issue persists 🙌