You are here

function _authcache_debug_watchdog_enabled in Authenticated User Page Caching (Authcache) 7.2

Return true when log-to-watchdog is enabled for the logged in user.

1 call to _authcache_debug_watchdog_enabled()
authcache_debug_log in modules/authcache_debug/authcache_debug.module
Log a message to the debug widget and / or watchdog.

File

modules/authcache_debug/authcache_debug.module, line 217
Debug widget for Authcache.

Code

function _authcache_debug_watchdog_enabled() {
  global $user;
  $enabled =& drupal_static(__FUNCTION__);
  if (!isset($enabled)) {
    if (authcache_debug_excluded()) {
      $enabled = FALSE;
    }
    else {
      switch (variable_get('authcache_debug_watchdog', AUTHCACHE_DEBUG_WATCHDOG_NEVER)) {
        case AUTHCACHE_DEBUG_WATCHDOG_ALWAYS:
          $enabled = TRUE;
          break;
        case AUTHCACHE_DEBUG_WATCHDOG_ENABLED_ROLES:
          $enabled = NULL === authcache_authcache_account_exclude($user);
          break;
        case AUTHCACHE_DEBUG_WATCHDOG_DEBUG_USERS:
          $enabled = $user->uid && in_array($user->name, variable_get('authcache_debug_users', array()));
          break;
        default:
          $enabled = FALSE;
          break;
      }
    }
  }
  return $enabled;
}