Drupal – adding debug messages to your custom module – Improved
As a follow up to ‘Drupal – adding debug messages to your custom module‘. I improved the code and wanted to share.
Now you can drop in a few functions and add one line to your hook_admin_settings function to get debugging functionality.
If you want to start with a baseline of functionality you can also update each of your functions to declare themselves in the debug messages. Which is handy for tracking down issues.
In the end you get the same addition to your GUI with control over how and when debug messages are used.
You also get the same reporting output, to the screen, watchdog, or both:
Here’s a quick look at my watchdog log gui with both types of error reporting enabled:
All done with cleaner code.
(more…)