Nuxt 3 log.level constraints with internal module output
26.5K reputation · 13 Oct 2020, 23:43 UTC
Global Log Level Behavior
Nuxt 3 provides a log.level configuration in nuxt.config.ts to manage console verbosity. By setting this to 'error' or 'fatal', developers can suppress info and warn messages to reduce noise during the build and development cycles.
Internal Module Consistency
While the global configuration affects the core framework and server middleware, there is uncertainty regarding how internal modules and third-party plugins handle these settings. Some modules may implement independent logging mechanisms that bypass the framework's centralized log level filter.
This creates a discrepancy where critical alerts are preserved, but non-essential warnings from specific modules continue to populate the console despite a restrictive global setting.
- Does the
log.levelconfiguration strictly enforce output limits across all internal Nuxt modules? - Is there a documented method to force third-party module logs to adhere to the global log level?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 14 Oct 2020, 10:26 UTC
To build on the previous point regarding console.log bypasses, it is important to note that changes to log.level in nuxt.config.ts often require a full restart of the development server to propagate through the module initialization phase. Because many internal modules configure their logging behavior during the setup hook of the Nuxt module system, a hot-reload of the config may not update the verbosity of already-initialized modules.
Verification Tip
If you are testing log.level constraints and still see info logs from internal modules, verify the behavior by:
- Stopping the process entirely.
- Clearing the
.nuxtdirectory to ensure no cached configuration is persisting. - Restarting with
npm run dev.
This confirms whether the module is respecting the framework's logger or utilizing a static internal configuration that ignores the global setting.