-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: log complete config in debug mode #18289
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Could it be set for the config loading specifically only? I'm not sure if Vite should change the default depth as that might expand other logs. |
That makes sense, it seems that adding a new configuration alone will have the least impact. |
Maybe we can add a |
Sorry for not responding before. I was thinking the depth could be more of an option for Great find with export function createDebugger(
namespace: ViteDebugScope,
options: DebuggerOptions = {},
): debug.Debugger['log'] | undefined {
const log = debug(namespace)
if (options.depth && log.inspectOpts.depth == null) {
log.inspectOpts.depth = options.depth
} What do you think? |
This looks good. However, I have a question. |
I'm not quite sure what you mean. Doesn't my code example only applies the custom depth to an instance of |
What I mean is that all debug logs that are output now are created by |
Oh, what I was thinking is that we don't need to have a new I think it should be enough for Vite to pass an opinionated: const debug = createDebugger('vite:config', { depth: 100 }) So that it gets a nice logging by default, only for the |
Directly configure the environment variable |
Directly configure the environment variable. The issue though is that because it defaults to 2 (via nodes formatWithOptions), it's not the best default to use for config logging. We could change the default for the specific logging instead to eg 10 so that it logs better without any config. But if the user explicitly set |
Oh, I see. However, changing this default value will cause the default output information structure to change. Will it affect some users? |
I think since it's only debug information, it should probably be safe. They should also get more logging of the config by default which I think is better. |
OK, I have updated it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Let's see what others think of this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this!
debugDepth
option
Description
When I set the debug parameters and prepare to view relevant information, I expect to be able to see some object information with a deeper nesting level more intuitively.