You are here

function ddl in Devel Debug Log 7

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

Saves a debug message.

Parameters

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

  • string: saved as is.
  • object or array: saved serialized.
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.

File

./devel_debug_log.module, line 36
Creates a page that shows debug messages.

Code

function ddl($message, $title = '') {
  if ((is_array($message) || is_object($message)) && !is_resource($message)) {
    $message = serialize($message);
    $serialized = TRUE;
  }
  else {
    $serialized = FALSE;
  }
  $query = db_insert('devel_debug_log')
    ->fields(array(
    'timestamp',
    'title',
    'message',
    'serialized',
  ));
  $query
    ->values(array(
    'timestamp' => REQUEST_TIME,
    'title' => $title,
    'message' => isset($message) ? $message : 'NULL',
    'serialized' => $serialized ? 1 : 0,
  ));
  $query
    ->execute();
}