You are here

function _messaging_log_format in Messaging 6.2

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

Format messaging / notifications log as single text line

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

File

./messaging.module, line 1360

Code

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

    // Transform arguments before inserting them.
    $append = $replace = $objects = array();
    foreach ($args as $key => $value) {
      if (is_array($value) || is_object($value)) {
        $objects[$key] = $value;
      }
      else {
        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;
        }
      }
    }
    $string = strtr($string, $replace);
  }
  return array(
    $type,
    $string,
    $append,
    $objects,
  );
}