You are here

function _messaging_log_format in Messaging 7

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

Format messaging / notifications log as single text line

2 calls to _messaging_log_format()
MessagingTestCase::dumpLogs in tests/messaging_test_case.inc
messaging_log_format in messaging_devel/messaging_devel.module
Format logs

File

messaging_devel/messaging_devel.module, line 405
Simple messaging using html page. Messaging method plug-in

Code

function _messaging_log_format($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_numeric($value) || is_string($value)) {
        switch ($key[0]) {
          case '@':

            // Escaped only.
            $replace[$key] = check_plain($value);
            break;
          case '%':
            $replace[$key] = drupal_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;
        }
      }
      elseif (is_array($value) || is_object($value)) {
        $objects[$key] = $value;
      }
    }
    $string = strtr($string, $replace);
  }
  return array(
    $type,
    $string,
    $append,
    $objects,
  );
}