next-axiom: Axiom is not formatting my logs properly
I have a nextjs project on vercel using axiom for logging.
On the logs tab in Vercel, my log is being properly formatted like so:
Starting endpoint {
path: '/api/interviews/sendUserMessage',
assistantId: 'asst_I5VvxwtWttxq7hg9GwxXPEPj',
interviewId: 'clrcweurd00019mz85x8vrzaf',
threadId: 'thread_nvLQOiEN1HHyEZijlHt5iYh2',
userId: 'user_2ahEnXntrH6x792VvzOXnsPYQyY'
}
but if you look at the attached image you can see that each field in the JSON is being split up into its own individual log message.
I am calling the log.info like so:
export const logStartEndpoint = (
log: Logger,
args: { [key: string]: any } = {}
) => {
const logger = log.with(args);
logger.info(`Starting endpoint`);
console.log(`Starting endpoint`, args);
};
Am I doing something wrong? i would ideally want each field to be a part of the properties that are logged with the top level message of Starting endpoint
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 6
- Comments: 16 (3 by maintainers)
We were able to reproduce and we are working on a fix. Just wanted to note that this is not related to
next-axiombut related to Axiom Log Drain on Vercel integration. When the fix is released it will just work for you, you will not have to update anything. Will keep you posted.Just want to pile on, having the same issues here. Printing an object results in each line of the object being a separate item in Axiom. It is pretty much unusable.
Hi @testerez , thats insightful, I will use your test to reproduce and debug whats going on.