You are here

function _notifications_log_format in Notifications 6

Format notifications log

1 string reference to '_notifications_log_format'
_notifications_log in ./notifications.module
Quick logging for debugging and manual queue processing

File

./notifications.module, line 1767
Notifications module

Code

function _notifications_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);
          break;
      }
    }
    $string = strtr($string, $args);
    $append ? $string .= ' ' . implode(', ', $append) : NULL;
  }
  return '<strong> ' . $type . '</strong>: ' . $string;
}