Developer experience

Debugging and logging

Current and future developers should have a easy way to debug their code and get important logging information when things break.

Debugging

When developing your web site it's important to get information about how the code runs. It can be memory usage, how many database queries in run or debug messages with information. This should only be run when during development to not cause performance problems.

Laravel / Statamic

When using Laravel, there is a great library called Laravel Debugbar what adds a bar at the bottom of the page with information. This should always be used when developing.

Also, there is a library called Laravel Telescope that adds a separate page with information. This works great when building an API and you do not want additional html (from the debugbar) shown.

composer require barryvdh/laravel-debugbar laravel/telescope --dev
php artisan telescope:install
php artisan migrate

.NET

For .NET there is a open source debug profiler called MiniProfiler that adds a small clickable debug box with information about how your code runs.

The project has different Nuget packages depending on CLI or MVC project.

Wordpress

When developing in Wordpress, make sure that the WP_DEBUG constant is set to true. This makes sure that error messages in shown.

Also, there is a plugin called Debug Bar that adds a debug information to your site.
Wordpress generally runs MANY database queries and this plugin is a nice way of getting that information and try to optimize.

composer require wpackagist-plugin/debug-bar --dev

Logging

Debugging is nice while developing, but if something goes wrong in the production environment it is really valuable to get as much information as possible. Generally, you will only get "something broke" from your clients. Getting information on which code breaks can greatly decrease the time finding the problem.

Log files

Servers and software often generate log files with errors reported. But this requires access to servers and some errors might not ever be reported and missed. It's important to know where to find the log files when needed, but generally it's good to have another solution for logging and error reporting.

Laravel, PHP and JavaScript

There is a service called Flare that is built for Laravel but works great to report errors from all PHP applications and JavaScript from the client.

You can also get emails when error happens so that you can make sure to fix problems as soon as possible.

No matter what solution, it's important to have some error reporting to make sure everything works.

To do

  • Debugging functionality is implemented when developing.

  • Error logging and reporting has been implemented.