You are here

function _messaging_log_prepare in Messaging 6.3

Prepare log item for formatting

Each log item has type, string, args, severity

1 call to _messaging_log_prepare()
messaging_log_format in ./messaging.module
Format logs

File

./messaging.module, line 1108

Code

function _messaging_log_prepare($log) {
  list($type, $string, $args, $severity) = $log;
  $append = $replace = $objects = array();
  if ($args) {

    // Transform arguments before inserting them.
    foreach ($args as $key => $value) {
      if (is_string($value) || is_numeric($value)) {
        switch ($key[0]) {
          case '@':

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

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

            // Append to string a key value pair, different from watchdog format
            $append[$key] = '<strong>' . $key . '</strong>= ' . check_plain($value);
            break;
        }
      }
      else {
        $objects[$key] = $value;
      }
    }
    $string = strtr($string, $replace);
  }
  return array(
    $type,
    $string,
    $append,
    $objects,
  );
}