pve2-api-php-client icon indicating copy to clipboard operation
pve2-api-php-client copied to clipboard

Debug Mode (Verbose Logging/Reporting); PSR-3 logging interface for PHP

Open naja7host opened this issue 9 years ago • 4 comments

the debug mode no longer exist in the new class .

where we can active the debug mode and show the full response ?

naja7host avatar Sep 23 '15 13:09 naja7host

It's already sent to the error logs on every request.

danhunsaker avatar Sep 23 '15 17:09 danhunsaker

the old method is wonderful . in some case with the actual scenario, can the error log become more bigger after some time of use , also we need every time to check the error log to see what happen . the old method was very useful as it print the details directly to view .and this is want any developer want .

any option to return the debug mode option as it was before or at least make selection between print the response or log it to the error log .

.

naja7host avatar Sep 23 '15 23:09 naja7host

Since writing the new version, I've learned that a PSR-3 logger would be better than using the system logs. Then you can set up your logger to output to the view instead of a file, or even set up a null logger to just do nothing with the data at all.

However, I can say that outputting error data directly into the view is not what any developer would want, as I tend not to. Aside from error messages intended for the end user, I've found that most error messages end up breaking the view entirely, and then if I forget to disable the debug mode (which, if I wrote the software properly, wouldn't happen in production, but anything's possible), end users don't get a better view into what my code is doing than is safe to give them.

Still, PSR-3 is the right approach here. If someone wants to whip up a PR for that, I'd happily merge it in. Or I may be able to get to it myself in the next week or so.

danhunsaker avatar Sep 24 '15 00:09 danhunsaker

i have never worked the PSR-3 .

what i do always it to set debug var to false , and when it true i output the full message to the view , that way i can view the error directly . and in the final code i set debug to false .

naja7host avatar Sep 26 '15 13:09 naja7host