Exemplo n.º 1
0
 /**
  * Returns the logger object. If no logger has been initialized, FileLog will be initialized and returned.
  *
  * @access private
  * @return Log
  * @throws Exception thrown if the logger class cannot be instantiated.
  */
 private static function getLogger()
 {
     if (!self::$logger) {
         global $specialLogUsers;
         // This variable comes from the configuration file (config.php)
         $logger = LOGBACKEND_CLASS;
         if (!class_exists($logger)) {
             $errmsg = 'The configured logging class `' . $logger . '` does not exist. Check your configuration.';
             error_log($errmsg);
             throw new \Exception($errmsg);
         }
         list($user) = Utils::SplitDomainUser(strtolower(Request::GetGETUser()));
         $user = '******' . $user . ']';
         self::$logger = new $logger();
         self::$logger->SetUser($user);
         self::$logger->SetAuthUser(Request::GetAuthUser());
         self::$logger->SetSpecialLogUsers($specialLogUsers);
         self::$logger->SetDevid('[' . Request::GetDeviceID() . ']');
         self::$logger->SetPidstr('[' . str_pad(@getmypid(), 5, " ", STR_PAD_LEFT) . ']');
         self::$logger->AfterInitialize();
     }
     return self::$logger;
 }