You are here

function _syslog_advanced_autoadd in Advanced syslog 7

Automatically adds new message types to the allowed list.

Parameters

string $type: Message type.

1 call to _syslog_advanced_autoadd()
syslog_advanced_watchdog in ./syslog_advanced.module
Implements hook_watchdog().

File

./syslog_advanced.module, line 285
Redirects logging messages to syslog.

Code

function _syslog_advanced_autoadd($type) {
  $allowed = variable_get('syslog_advanced_allowed');
  if (!isset($allowed[$type])) {
    $autoadd = variable_get('syslog_advanced_autoadd');
    if (!$autoadd) {
      $autoadd = _syslog_advanced_default_severities();
    }
    foreach ($autoadd as $code => $value) {
      $autoadd[$code] = (int) ($code == $value);
    }
    $allowed[$type] = $autoadd;
    variable_set('syslog_advanced_allowed', $allowed);
  }
}