feat: add enabled?: boolean config option to disable logger#69
feat: add enabled?: boolean config option to disable logger#69HugoRCD merged 5 commits intoHugoRCD:mainfrom
enabled?: boolean config option to disable logger#69Conversation
|
@Pastequee is attempting to deploy a commit to the HRCD Projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions! 🙏 |
There was a problem hiding this comment.
Pull request overview
Adds a global enabled?: boolean configuration option (defaulting to true) to allow consumers to fully disable logging behavior across server/client runtimes.
Changes:
- Introduces
enabled?: booleanin logger/module config types and propagates it into Nuxt runtime config. - Implements global enable/disable behavior (server + client), including no-op request logger behavior and early return in Nitro plugin.
- Adds test coverage and updates README/docs to document the new option.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/evlog/src/types.ts | Adds enabled?: boolean to LoggerConfig with documentation. |
| packages/evlog/src/logger.ts | Implements global enable flag, exports isEnabled(), and adds a no-op request logger when disabled. |
| packages/evlog/src/index.ts | Re-exports isEnabled. |
| packages/evlog/src/nitro/plugin.ts | Reads enabled from runtime config; returns early when logging disabled. |
| packages/evlog/src/nuxt/module.ts | Adds module option + forwards enabled into public.evlog. |
| packages/evlog/src/runtime/client/plugin.ts | Passes enabled from public runtime config into client logger init. |
| packages/evlog/src/runtime/client/log.ts | Adds client-side enable flag to short-circuit all emits when disabled. |
| packages/evlog/test/logger.test.ts | Adds tests to verify disabled behavior is no-op and enabled behavior unchanged. |
| packages/evlog/README.md | Documents the new enabled option in init example. |
| apps/docs/content/1.getting-started/2.installation.md | Documents enabled in configuration option table. |
| README.md | Documents the new enabled option in init example. |
| AGENTS.md | Documents enabled in configuration option table. |
| bun.lock | Lockfile metadata update (configVersion). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * log.emit() | ||
| * ``` |
There was a problem hiding this comment.
The JSDoc block appears to document createRequestLogger, but it now sits immediately above noopLogger, so tooling will associate the comment with the wrong symbol. Move noopLogger above the JSDoc block (or move/duplicate the JSDoc so it directly precedes createRequestLogger).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
commit: |
🔗 Linked issue
None
📚 Description
Add an
{ enabled?: boolean }config option that default totrueto dynamically disable the logger depending on whatever the user wants.My main use case here is to disable the logger in test environments like so:
enabled: process.env.NODE_ENV !== 'test'📝 Checklist
Thoughts
I have implemented this is a noop "mock" way, I don't know if its how you would have want to do it, but feel free discard the PR and just consider this as a feature request if you'd like.