Debugging and Logs
Table of contents
1. Overview Table of Contents
This framework provides built-in tools for identifying and resolving issues during development. These include:
- An interactive error display system powered by filp/whoops
- Application and CLI log files for capturing system events
- Developer-friendly helper functions for debugging within controllers, views, or models
2. filp/whoops Table of Contents
filp/whoops is a pretty page handler for displaying errors within the browser. This tool is also included with the Laravel framework. Thus, inclusion of this tool within this frameworks makes the switch relatively easy.
3. Logs Table of Contents
This framework supports two types of log files, located under storage/logs
:
app.log
: Logs frontend and application runtime eventscli.log
: Logs activity from console commands
To clear these logs, use the following command:
php console log:clear
This command has 4 flags that can be set.
--all
: Clears both log files--app
: Clears only app.log--cli
: Clears only cli.log--unit
: Clears only phpunit.log
If the framework has issues writing to the logs files run the following command:
sudo chmod -R 775 storage/logs/
sudo chown ${user}:${user} -R /storage/logs
3. Helper Functions Table of Contents
There are 3 functions in the Global Namespace that are used for debugging.
Function | Description |
---|---|
cl($var) |
Prints a JavaScript console.log statement for the given variable. Output will appear in the browser’s developer console. Useful for debugging view-layer variables. |
dump($var) |
Dumps variable content using Symfony’s VarDumper , but allows the application to continue executing. |
dd($var) |
Same as dump , but halts further execution immediately after the call (short for “dump and die”). |
Example Usage:
$user = Users::findById(1);
dd($user); // Stops here and dumps user info
Use these tools to inspect variables during development, troubleshoot bugs, or validate your logic at runtime.