SimpleSAML\Logger::createLoggingHandler PHP Method

createLoggingHandler() private static method

private static createLoggingHandler ( $handler = null )
    private static function createLoggingHandler($handler = null)
    {
        // set to false to indicate that it is being initialized
        self::$loggingHandler = false;
        // a set of known logging handlers
        $known_handlers = array('syslog' => 'SimpleSAML\\Logger\\SyslogLoggingHandler', 'file' => 'SimpleSAML\\Logger\\FileLoggingHandler', 'errorlog' => 'SimpleSAML\\Logger\\ErrorLogLoggingHandler');
        // get the configuration
        $config = \SimpleSAML_Configuration::getInstance();
        assert($config instanceof \SimpleSAML_Configuration);
        // setting minimum log_level
        self::$logLevel = $config->getInteger('logging.level', self::INFO);
        // get the metadata handler option from the configuration
        if (is_null($handler)) {
            $handler = $config->getString('logging.handler', 'syslog');
        }
        if (class_exists($handler)) {
            if (!in_array('SimpleSAML\\Logger\\LoggingHandlerInterface', class_implements($handler))) {
                throw new \Exception("The logging handler '{$handler}' is invalid.");
            }
        } else {
            $handler = strtolower($handler);
            if (!array_key_exists($handler, $known_handlers)) {
                throw new \Exception("Invalid value for the 'logging.handler' configuration option. Unknown handler '" . $handler . "''.");
            }
            $handler = $known_handlers[$handler];
        }
        self::$loggingHandler = new $handler($config);
        self::$format = $config->getString('logging.format', self::$format);
        self::$loggingHandler->setLogFormat(self::$format);
    }