-
Notifications
You must be signed in to change notification settings - Fork 260
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
[CLI] Set debug constants during boot #1983
Conversation
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 left a question about WP_DEBUG_DISPLAY, but this looks good and tests well to me. Thanks, Bero!
{ | ||
WP_DEBUG: args.debug, | ||
WP_DEBUG_LOG: args.debug, | ||
WP_DEBUG_DISPLAY: false, |
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.
In your experience, is this something that most people prefer to disable? It's not clear to me that I'd want it disabled if running with the --debug
flag because having messages printing in-page might be the feedback that is easiest to access.
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.
WP_DEBUG_DISPLAY
is rarely enabled. It literally prints all error levels into the HTML and most of the time messes up the page.
But now when I think of it, the point of the debug flag is to control the displaying of logs and not data collection.
I will set these the same way we do on the Website and users can always override them using Blueprints.
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.
This is the debug flag description. It shouldn't control logging.
'Return PHP error log content if an error occurs while building the site.', |
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.
What does "return" mean in this context? It's not a function return
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.
And let's update the description to clarify this – is the --debug
flag only effective at build time? Or does it also affect the runtime or the built site later on?
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.
Ok!
is the --debug flag only effective at build time? Or does it also affect the runtime or the built site later on?
Only during the build, but it would be nice for it to also return errors during runtime.
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.
By "return" do you mean "print"? Or "save to file"? Or something else?
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.
It's printing, thanks for the questions, they help narrow down what's missing in the text.
Here is an improved version https://github.com/WordPress/wordpress-playground/pull/1985/files#diff-ff00c9c03a9587a4ac648349850e14a53fdd62418bce04573537c9c794c95811R107
@@ -215,7 +215,6 @@ async function run() { | |||
php: args.php as SupportedPHPVersion, | |||
wp: args.wp, | |||
}, | |||
login: args.login, |
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.
What happened here? Why remove this @bgrgicak ?
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.
It was causing errors and it's not supported anymore since we changed the way login works. Should I open an issue to add login support?
We have an option to login users with CLI, but it requires a specific URL parameter (playground_force_auto_login_as_user
), we could print this in the CLI output and enable users to login that way.
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.
Couldn't login work the same way as on Playground web?
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.
PR to fix login #1985
I like having a |
This PR sets the WordPress debug constants during the CLI boot.
Depending on the
--debug
flag,WP_DEBUG
, andWP_DEBUG_LOG
will be set to true or false during boot.The
WP_DEBUG_DISPLAY
constant will always be set tofalse
to match the Website behavior.Disabling
WP_DEBUG_DISPLAY
will also avoid crashing the CLI during boot if a plugin activation fails. Long-term #1979 shouldn't crash Playground anymore, but we still want these constant defaults in the CLI.Testing Instructions (or ideally a Blueprint)
BLUEPRINT_PATH
to match your path)