I am trying to improve the performance of some code in my site and found this profiler: < P> I have followed the guidance on the site and one of the site controllers has included the following:
public function getTest () {$ logger = new profiler \ logger \ logger; $ Profiler = new profiler profile ($ logger); $ Profiler- & gt; StartTimer ('testLogging'); $ Data = paragraph :: select (array ('article.ede', 'article, newspaper,' article. Ijd_link ',' article title ',' article category ')) - & gt; Received () - & gt; ToArray (); Var_dump ($ data); $ Profiler- & gt; EndTimer ('testLogging'); Log: info ('Hello World!'); Echo $ profiler; In the browser, I get the expected result and see the profile bar below.
I have a problem: In this basic test the profiler bar, when clicked is not open, so I am unable to see the logs etc. I'm not sure about why or how to go about fixing
If I remove the last echo then it works correctly.
However, I can not see the timer 'Test Leasing' in the toolbar.
Did I misunderstand a concept here?
How can I perform specific functions in my code and display results?
Thanks
To use the professor (Lute-Sharm / Profiler) In Laravel 4 properly you do not need to make an example example of the object.
$ logger = new profiler \ logger \ logger; $ Profiler = new profiler profile ($ logger); In these lorries, these beautiful things, called Facees, apply to Profiler so that you can call the profiler and log it like this: public function getTest () {Profiler :: Start Timer ('Test Leasing'); $ Data = paragraph :: select (array ('article.ede', 'article, newspaper,' article. Ijd_link ',' article title ',' article category ')) - & gt; Received () - & gt; ToArray (); Var_dump ($ data); Profiler :: endTimer ('testLogging'); Log: info ('Hello World!'); } This does not require you to resize the $ profiler, all output will be displayed automatically in the profile bar in the browser.
: After Professor now it usually means that you are using a mask, it is important that you understand that the mask and $ Profiler are completely different - There are different institutions. If you have not installed yet or the service provider does the following:
- You first need to install a package with the composer, make sure you update the composer update
- Add the next service to
- ap / config / ap.php
- in your composer.jason after adding "requirement".
-
- Next Eddie
'Profiler Professor Service Provider', Code> 'Profiler' = & gt; In the list of class aliens in the App / Config / APPPP, click on 'Profiler / Appes / Profiler', - Then enter
php artisan config: publish loic-sharma / profiler in console run < / Code> You have completed that the above mentioned code should work completely.
To clarify what you did just wrong, you created a new installation; Profiler with the new profiler logger \ loger; If you had already set up the Fapas, the Profiler bar will already be displayed in the browser (will resonate) when you echo the $ profiler; You now have two profiles in your browser, open-ended issues arise, and when you do not resonate $ profiler, the bar still appears because it will be displayed by you Not created one that is not displaying your output correctly. If you still want to use Profiler's own instances:
-
'Profiler \ ProfilerServiceProvider' from the list of services, Delete the provider in AP / Config / APPP -
'Profiler' = & gt; In the app / config / apppp, the list of 'aliens' in the category of 'profiler apes \ proferrari', - then
php artisan dump-autoload < / Li> Then it will work:
public function getTest () {$ logger = new profiler \ logger \ logger; $ Profiler = new profiler profile ($ logger); $ Profiler- & gt; StartTimer ('testLogging'); $ Data = paragraph :: select (array ('article.ede', 'article, newspaper,' article. Ijd_link ',' article title ',' article category ')) - & gt; Received () - & gt; ToArray (); $ Logger- & gt; Debug (var_dump ($ data)); $ Profiler- & gt; EndTimer ('testLogging'); $ Logger- & gt; Information ('hello world!'); Echo $ profiler; }
No comments:
Post a Comment