-
-
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
[Suggestion / Frameworks] Log level and log customization #1220
Comments
I've written up a logger in #1015 that we can build upon (see the code here). It doesn't yet have log levels or the |
we'd recommend the global logging utility, without a doubt. In the rare scenarios when a ton of rapid logging is happening just deal with that "in context" using lodash Some tips on formatting: In node, we add some nice formatting using CLI Highlight, PrettyOutput, and Consola for errors. In the browser we add some formatting like this: console.log(
`%c${category} > ${description}`,
`font-weight:bold;color: ${color};padding: 5px 0;${additional}`,
data ?? "",
)
} |
What exactly is the benefit of a global logger?
That wouldn't work. Logging spans across modules and even plugins. The point of request-specific loggers is being able to "mute" an entire request, not to throttle its logs arbitrarily. |
Create a singleton then and throttle that. The benefit is DRY code that can be modified or extended in one place. |
Addressed in 2.0 via https://vitejs.dev/config/#loglevel |
Just a simple request to make logging customizable for frameworks.
Specifically, we'd like to integrate the vite logging into the logging style used by the upcoming Factor headless-framework.
Additionally, the log level should be supported.
Currently, you're just logging stuff like this:
For your consideration, you could use the format:
Within the
vlog
function you could allow customization, as well as apply level handling and formatting...The text was updated successfully, but these errors were encountered: