Krumo NG (krumong) is a rewrite of the Krumo library used by devel.
The main motivation is that the original Krumo library has some weird side effects.
This module may be merged into devel, but for now a separate project is a more useful place for development.
- Most important: Immunity to
- Cleaned-up architecture (compared to krumo).
- Reduced html code: Only the data is encoded in the page html, the html tags are expanded by client-side js.
- Delayed js/css inclusion: If a dpm() is delayed to the next request (e.g. because of a redirect, or because it is called during page.tpl.php), the required js and css (krumong.css, krumong.js) inclusion waits for the page where the messages are actually displayed.
- js/css on broken pages: You can type
krumong()->kPrint(); die();, and you will still have the js and css needed for the nice print.
- Option to dump objects to js console.log. via
- Uses the same permissions as devel.
The output looks very similar to what you are used to from devel/krumo, and there are no plans to change this.
- Dependency: X Autoload for the PSR-0 class loading.
- Recommended: Also install/enable Devel.
KrumoNG uses the 'access devel information' permission provided by Devel.
The only reason not to enable Devel would be for some exotic testing purposes.
- Install/enable krumong like any other module.
Integration in Devel
A "proof of concept" integration patch can be found here:
With this patch, you can use the regular devel dpm() and friends, and it will use krumong instead of devel/krumo.
Independent use as Devel equivalent
krumong is designed as a full replacement of devel debug functions such as dpm() and friends.
However, to avoid a nameclash with devel, it does not occupy the global namespace. There are two ways to call krumong equivalents to devel functions:
use Drupal\krumong as k; ... k\dpm($data);
// The object returned by krumong('devel') provides methods equivalent to popular devel functions. krumong('devel')->dpm($data);
// print to stdOut with js and css. // Use this on "broken" pages where drupal_add_css() and drupal_add_js() does not work. krumong()->kPrint($data); (die;) // optionally, you can stop the request right here. // print to console.log the next time a request comes to print messages. krumong()->jMessage($data); // print to console.log, with a script that goes directly to stdOut. krumong()->jPrint($data); // Print as anonymous user, ignoring the 'access devel information' access checks. krumong('main')->kPrint($data);