You are here

function ddl in Devel Debug Log 8

Same name and namespace in other branches
  1. 7 devel_debug_log.module \ddl()

Saves a debug message.

Parameters

mixed $message: A debug message to save, which can be:

  • string: saved as it is;
  • object/array: serialized before saving;

Currently, there's development going on regarding the serialization part, since most of the data in D8 contains references to injected services and maybe even plugins. A discussion about this topic can be found here: @see https://www.drupal.org/node/2705731

string $title: Title of the debug message.

1 call to ddl()
ddl_once in ./devel_debug_log.module
Checks if the message has already been saved during the current page request, and saves the message only if it is not a repetition of a previous one.
2 string references to 'ddl'
DevelDebugLogExtension::getFunctions in src/Twig/DevelDebugLogExtension.php
DevelDebugLogExtension::getName in src/Twig/DevelDebugLogExtension.php

File

./devel_debug_log.module, line 26
Contains Drupal\devel_debug_log\devel_debug_log.module.

Code

function ddl($message, $title = '') {
  $serialized = FALSE;
  $message = devel_debug_log_ob_kint($message);

  // TODO Find a way to store the initial message, instead of storing the entire
  // debug markup returned by kint().
  $connection = \Drupal::database();
  $query = $connection
    ->insert('devel_debug_log')
    ->fields(array(
    'timestamp' => \Drupal::time()
      ->getRequestTime(),
    'title' => $title,
    'message' => $message,
    'serialized' => $serialized ? 1 : 0,
  ));
  $query
    ->execute();
}