-
Notifications
You must be signed in to change notification settings - Fork 3
Debugging
The debug class is a very simple class that makes it easy to write debug messages. Debugging can be turned off and on in the settings.php file depending on the current environment. This is very useful when migrating to the production environment to ensure that all debug messages are hidden from the end-user.
use \Sleepy\Core\Debug;
Debug::out('Example Message!');The Debug::out() static method can also take arrays, objects, or anything that can be passed to var_dump.
There are four ways you can display your debugging information. They are:
- Output to the screen
- Output to email
- Output to a database
- Output to the Developers Console
By default, the output is set to be displayed in the Developers Console. This is great because it allows the folding of arrays and objects. This is simply accomplished by json encoding the debug message and wrapping the output in a console.dir().
The email address and database information can be set up from the settings.php file. These outputs are especially good for use in production environments because they record the errors without notifying the end user of the details. Exposing details of the system is a security risk and so it is disabled by default in the production environment.