This repository was archived by the owner on Jun 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
feat: support custom raw logger #461
Open
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this pull request solving?
This PR proposes two changes to the API of the recently-added system logger:
Remove the
NETLIFY_DEV
andNETLIFY_ENABLE_SYSTEM_LOGGING
environment variables in favour of a newSilent
log level. If we want to silence the logger from the CLI or any other consumer applications, we should let them configure that behaviour themselves rather than making the logger rely on their internals.Moreover, this lets the CLI more easily configure this behaviour conditionally — e.g. show system logs if the
--debug
flag has been used, which is what we do currently with edge functions.Allow consumers to specify a custom raw logger that replaces the default
globalThis.console
methods. We can use this to plug this logger into the system logger that we expose to build plugins, where we want to callutils.systemLog
and notconsole.log
on the resulting payload.I'm exporting the underlying class (which I've renamed to
StructuredLogger
, because I think it's more accurate), which accepts a raw logger in the constructor.