NuxtN
Nuxt15mo ago
18 replies
dmarr

How do I add a custom log reporter to nuxt?

I have tried using a module to call the addReporter function on the logger instance like so:
import { useLogger } from "nuxt/kit";
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  modules: [() => {
    const logger = useLogger();
    logger.addReporter({
      log(logObj) {
        console.log(JSON.stringify(logObj));
      }
    })
  }]
})

But when running a build, I see a maximum call stack error
Was this page helpful?