You are here

function swftools_set_error in SWF Tools 6.3

Outputs a message to the screen and/or the watchdog, according to the configuration settings.

Parameters are as watchdog().

See also

watchdog()

1 call to swftools_set_error()
swf in ./swftools.module
Processes a file, or an array of files, and returns the relevant mark-up to render a Flash based player.

File

./swftools.module, line 2172
The primary component of SWF Tools that enables comprehensive media handling.

Code

function swftools_set_error($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {

  // Find out where this message should go
  $destination = variable_get('swftools_error_output', SWFTOOLS_ERROR_WATCHDOG_AND_SCREEN);

  // drupal_set_message uses error, warning and status, not severity levels
  $status = array(
    WATCHDOG_EMERG => 'error',
    WATCHDOG_ALERT => 'error',
    WATCHDOG_CRITICAL => 'error',
    WATCHDOG_ERROR => 'error',
    WATCHDOG_WARNING => 'warning',
  );
  $status += array(
    $severity => 'status',
  );

  // Write to screen?
  if ($destination & SWFTOOLS_ERROR_SCREEN) {
    drupal_set_message(t($message, $variables), $status[$severity]);
  }

  // Write to watchdog?
  if ($destination & SWFTOOLS_ERROR_WATCHDOG) {
    watchdog($type, $message, $variables, $severity, $link);
  }
}