Skip to content

Added a pretty_print option to the log class #1473

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

Merged
merged 1 commit into from
Jan 6, 2013

Conversation

s4wny
Copy link

@s4wny s4wny commented Nov 25, 2012

It isn't useful to log arrays if the result is 'Array'.

I noticed that I often use Log::info(print_r($array, true)); and I'am probably not alone, so why not add this as a feature to the framework?

With this change you just need to write Log::info($array, true);

It isn't useful to log arrays if the result is 'Array'.

I noticed that I often use `Log::info(print_r($array, true));` and I'am probably not alone, so why not add this as a feature to the framework?
@JoostK
Copy link
Contributor

JoostK commented Nov 26, 2012

If you'd ask me we could get rid of manually specifying pretty print arguments and just use print_r if the log message is an array.

@s4wny
Copy link
Author

s4wny commented Nov 27, 2012

Yeah that would work for me too. But you need to have backwards compatibility in mind. Anyway, can someone accept this pull request? I think many people want this feature.

@laurencei
Copy link
Contributor

I just found this pull. I did something similar, but I approached it from a different angle. I can now just use "Profiler::log('test', $array)" and get the array fully printed (including objects) - with one single line change: #1525

@s4wny
Copy link
Author

s4wny commented Dec 15, 2012

Smart!

But one problem with your code is that the log file will still just contain "array". And sometimes you need to check to log file, in example when you do AJAX request.

@laurencei
Copy link
Contributor

Yeah - true - but since Laravel 4 is just around the corner I didnt want to bother with massive changes for the current profiler. This way it allows for simple debugging on my dev site

@Geczy
Copy link

Geczy commented Jan 5, 2013

I made a pull to solve the 'Array' 4 months ago, #1208 . I used var_export. It solves both the logger & profiler.

taylorotwell added a commit that referenced this pull request Jan 6, 2013
Added a pretty_print option to the log class
@taylorotwell taylorotwell merged commit 2946274 into laravel:master Jan 6, 2013
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.

5 participants