-
-
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
refactor: make debugger nullable #12687
Conversation
Run & review this pull request in StackBlitz Codeflow. |
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.
LGTM
Maybe returning Debugger | undefined
from createDebugger
makes it more simple?
Then, we can write debug?.('something')
instead of debug.enabled && debug('something')
.
Not sure why I didn't think of that, that feels simpler too 🤔 |
Updated. I like this new pattern instead, it makes all debug logs lazy by default now. |
+1 for the new pattern 💚 |
Description
Often times we do:
Where
isDebug
isprocess.env.DEBUG
, however that doesn't always mean thedebug
will run ifDEBUG="blabla"
and we're logging with thevite:time
namespace.To simplify this, the PR refactors as
debug?.('...')
instead.Additional context
Might make debug logs slightly more accurate.
What is the purpose of this pull request?