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

Set debug level for output #103

Merged
merged 3 commits into from
Apr 10, 2012
Merged

Set debug level for output #103

merged 3 commits into from
Apr 10, 2012

Conversation

thomseddon
Copy link
Contributor

Firstly, just set out building my own asset compressor to find you had already done it! Another great CakePHP contribution, thanks Mark.

One quick question: I noticed that it seems the output is only passed through the filter at debug levels below 2, and this seems to be hard coded on this line?

I was running the shell on my development build (debug at 2) so couldn't actually pass the output through a filter?

I have attached a quick way I overrode it - sorry if I have just missed something.

Thanks again!

@markstory
Copy link
Owner

One reason the output filters don't run when debug = 2 is because running code through minifiers is generally not helpful in web requests when you're debugging. I agree though that running the shell even with debug = 2 should not disable any output filters.

I think another way to solve this could be to check if the current execution context is a console command, and then run the output filters regardless of the debug level.

@thomseddon
Copy link
Contributor Author

Yeah, suppose that makes more sense, have pushed up something more towards that.

Not sure if there is a better way to detect if we are running shell, one option would be to directly check if we are using the cli SAPI with php_sapi_name(), but not sure if this is robust enough to fit all use cases? (although it wouldn't be breaking any kind of backwards compatibility if it didn't!?)

Haven't been to intimate with writing a Cake Shell before so there may be a better way to check from there, perhaps checking if the Shell class exists?

@markstory
Copy link
Owner

I think using php_sapi_name() == 'cli' is totally reasonable. I've not seen that screw up yet :)

@thomseddon
Copy link
Contributor Author

Crackalackin, have just done that then

markstory added a commit that referenced this pull request Apr 10, 2012
Set debug level for output
@markstory markstory merged commit 6e8f337 into markstory:master Apr 10, 2012
@markstory
Copy link
Owner

Awesome, thank you :D

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.

2 participants