コード例 #1
0
 private static function createLoggingHandler()
 {
     // set to FALSE to indicate that it is being initialized
     self::$loggingHandler = FALSE;
     // get the configuration
     $config = SimpleSAML_Configuration::getInstance();
     assert($config instanceof SimpleSAML_Configuration);
     // get the metadata handler option from the configuration
     $handler = $config->getString('logging.handler', 'syslog');
     // setting minimum log_level
     self::$logLevel = $config->getInteger('logging.level', self::INFO);
     $handler = strtolower($handler);
     if ($handler === 'syslog') {
         $sh = new SimpleSAML_Logger_LoggingHandlerSyslog();
     } elseif ($handler === 'file') {
         $sh = new SimpleSAML_Logger_LoggingHandlerFile();
     } elseif ($handler === 'errorlog') {
         $sh = new SimpleSAML_Logger_LoggingHandlerErrorLog();
     } else {
         throw new Exception('Invalid value for the [logging.handler] configuration option. Unknown handler: ' . $handler);
     }
     self::$format = $config->getString('logging.format', self::$format);
     $sh->setLogFormat(self::$format);
     // set the session handler
     self::$loggingHandler = $sh;
 }