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; }
public 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', LOG_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); } /* Set the session handler. */ self::$loggingHandler = $sh; }
public static function createLoggingHandler() { global $SIMPLESAML_INCPREFIX; /* Get the configuration. */ $config = SimpleSAML_Configuration::getInstance(); assert($config instanceof SimpleSAML_Configuration); /* Get the metadata handler option from the configuration. */ $handler = $config->getValue('logging.handler', 'syslog'); /* * setting minimum log_level */ self::$logLevel = $config->getValue('logging.level', LOG_INFO); /* If 'session.handler' is NULL or unset, then we want * to fall back to the default PHP session handler. */ if (is_null($handler)) { $handler = 'syslog'; } /* The session handler must be a string. */ if (!is_string($handler)) { throw new Exception('Invalid setting for the [logging.handler] configuration option. This option should be set to a valid string.'); } $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); } /* Set the session handler. */ self::$loggingHandler = $sh; }