function drupal_debug

Same name in other branches
  1. 7.x-1.x devel.module \drupal_debug()
1 call to drupal_debug()
dd in ./devel.module

File

./devel.module, line 1830

Code

function drupal_debug($data, $label = NULL) {
    ob_start();
    print_r($data);
    $string = ob_get_clean();
    if ($label) {
        $out = $label . ': ' . $string;
    }
    else {
        $out = $string;
    }
    $out .= "\n";
    // The temp directory does vary across multiple simpletest instances.
    $file = file_directory_temp() . '/drupal_debug.txt';
    if (file_put_contents($file, $out, FILE_APPEND) === FALSE) {
        drupal_set_message(t('Devel was unable to write to %file.', array(
            '%file' => $file,
        )), 'error');
        return FALSE;
    }
}