You are here

function _messaging_debug_log_text in Messaging 6.3

Same name and namespace in other branches
  1. 6 messaging_debug/messaging_debug.module \_messaging_debug_log_text()
  2. 6.2 messaging_debug/messaging_debug.module \_messaging_debug_log_text()

Format message as loggable text

3 calls to _messaging_debug_log_text()
messaging_debug_block in messaging_debug/messaging_debug.module
Implementation of hook_block()
messaging_debug_devlog_msg in messaging_debug/messaging_debug.module
Message processor, just log incoming messages
messaging_debug_watchdog_msg in messaging_debug/messaging_debug.module
Messaging processor

File

messaging_debug/messaging_debug.module, line 290
Simple messaging using html page. Messaging method plug-in

Code

function _messaging_debug_log_text($message) {
  $source = $message->source;
  $content = $message
    ->render();
  $variables = array(
    '%subject' => $content->subject,
  );
  if ($source['type'] == 'incoming') {
    $text = 'Incoming message, method %method, channel %channel: %subject';
    $variables += array(
      '%method' => $source['method'],
      '%channel' => $source['channel'],
    );
  }
  elseif ($source['type'] == 'outgoing') {
    $text = 'Outgoing message, method %method: %subject';
    $variables += array(
      '%method' => $content->method,
    );
  }
  else {
    $text = 'Unknown message type, full dump: %message';
    $variables['%message'] = print_r($message, TRUE);
  }
  return array(
    $text,
    $variables,
  );
}