Skip to content
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

Re-do: Configurable Roadrunner log level #604

Merged
merged 3 commits into from
Oct 26, 2022

Conversation

ejulen
Copy link
Contributor

@ejulen ejulen commented Oct 26, 2022

See #601. This adds a new flag, --log-level, to the octane:roadrunner command.

Was asked to provide an explanation as to why this broke; it was, simply put, due to an operator precedence issue added in the second commit.

'logs.level='.$this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn')

Will result in logs.level= (no actual level) if no --log-level option is given instead of falling back to the old behaviour, due to . having higher precedence than ?:.

Adding parentheses fixes this:

'logs.level='.($this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn'))

It's perhaps easiest to see with a simpler example:

'foo' . null ?: 'bar'

Results in foo, while

'foo' . (null ?: 'bar')

Results in foobar.

@taylorotwell taylorotwell merged commit 82a5b68 into laravel:1.x Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants