You are here

function _messaging_log in Messaging 6.4

Same name and namespace in other branches
  1. 6 messaging.module \_messaging_log()
  2. 6.2 messaging.module \_messaging_log()
  3. 6.3 messaging.module \_messaging_log()
  4. 7 messaging_devel/messaging_devel.module \_messaging_log()

Quick logging for debugging and manual queue processing

3 calls to _messaging_log()
messaging_log in ./messaging.module
Short hand for info logs
messaging_log_get in ./messaging.module
Get logs without formatting
messaging_log_start in ./messaging.module
Init logging system so logs are saved from now on

File

./messaging.module, line 1018

Code

function _messaging_log($type, $txt = NULL, $variables = NULL, $severity = WATCHDOG_NOTICE) {
  static $enabled = FALSE;
  switch ($type) {
    case 'info':
    case 'debug':
      if ($enabled) {
        $_SESSION['messaging_log'][] = array(
          $type,
          $txt,
          $variables,
          $severity,
        );
      }
      break;
    case 'return':
      return isset($_SESSION['messaging_log']) ? $_SESSION['messaging_log'] : NULL;
      break;
    case 'reset':
      unset($_SESSION['messaging_log']);
      break;
    case 'start':
      $enabled = TRUE;
      break;
    case 'stop':
      $enabled = FALSE;
      break;
  }
}