You are here

function _messaging_log_format in Messaging 6

Same name and namespace in other branches
  1. 6.4 messaging.module \_messaging_log_format()
  2. 6.2 messaging.module \_messaging_log_format()
  3. 7 messaging_devel/messaging_devel.module \_messaging_log_format()

Format notifications log

1 string reference to '_messaging_log_format'
_messaging_log in ./messaging.module
Quick logging for debugging and manual queue processing

File

./messaging.module, line 1074

Code

function _messaging_log_format($log) {
  list($type, $string, $args, $severity) = $log;
  if ($args) {

    // Transform arguments before inserting them.
    $append = array();
    foreach ($args as $key => $value) {
      if (is_array($value) || is_object($value)) {
        $value = print_r($value, TRUE);
      }
      switch ($key[0]) {
        case '@':

          // Escaped only.
          $args[$key] = check_plain($value);
          break;
        case '%':
          $args[$key] = theme('placeholder', $value);
          break;
        case '!':

          // Pass-through.
          $args[$key] = $value;
          break;
        default:

          // Append to string a key value pair, different from watchdog format
          $append[] = ' <strong>' . $key . '</strong>= ' . check_plain($value);
          $args[$key] = '';
          break;
      }
    }
    $string = strtr($string, $args);
    $append ? $string .= ' ' . implode(', ', $append) : NULL;
  }
  return '<strong> ' . $type . '</strong>: ' . $string;
}