function debug

Outputs debug information.

The debug information is passed on to trigger_error() after being converted to a string using _drupal_debug_message().

Parameters

$data: Data to be output.

$label: Label to prefix the data.

$print_r: Flag to switch between print_r() and var_export() for data conversion to string. Set $print_r to TRUE when dealing with a recursive data structure as var_export() will generate an error.

7 calls to debug()
FieldPluginBase::addAdditionalFields in drupal/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
Add 'additional' fields to the query.
hook_views_plugins_join_alter in drupal/core/modules/views/views.api.php
Modify the list of available views join plugins.
hook_views_plugins_query_alter in drupal/core/modules/views/views.api.php
Modify the list of available views query plugins.
Rss::render in drupal/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
Render the display in this style.
SimpleTestTest::stubTest in drupal/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
Test to be run and the results confirmed.

... See full list

11 string references to 'debug'
AssetFactory::generateAssetName in drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Factory/AssetFactory.php
AsseticNode::compile in drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Extension/Twig/AsseticNode.php
AsseticTokenParser::parse in drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Extension/Twig/AsseticTokenParser.php
CommentLinksTest::setEnvironment in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
Re-configures the environment, module settings, and user permissions.
CurlHandle::factory in drupal/core/vendor/guzzle/http/Guzzle/Http/Curl/CurlHandle.php
Factory method to create a new curl handle based on an HTTP request.

... See full list

File

drupal/core/includes/common.inc, line 5694
Common functions that many Drupal modules will need to reference.

Code

function debug($data, $label = NULL, $print_r = FALSE) {

  // Print $data contents to string.
  $string = check_plain($print_r ? print_r($data, TRUE) : var_export($data, TRUE));

  // Display values with pre-formatting to increase readability.
  $string = '<pre>' . $string . '</pre>';
  trigger_error(trim($label ? "{$label}: {$string}" : $string));
}