protected function loadLogger()
    {
        $logger = null;
        if ($this->hasOption(self::LOGGER_OPTION)) {
            $loggerOptions = $this->getOption(self::LOGGER_OPTION);
            if (is_object($loggerOptions)) {
                if (is_a($loggerOptions, LoggerInterface::class)) {
                    $logger = $loggerOptions;
                }
            } elseif (is_array($loggerOptions) && isset($loggerOptions['class'])) {
                $classname = $loggerOptions['class'];
                if (is_a($classname, LoggerInterface::class, true)) {
                    if (isset($loggerOptions['options'])) {
                        $logger = new $classname($loggerOptions['options']);
                    } else {
                        $logger = new $classname();
                    }
                }
            }
        }

        if (!is_null($logger)) {
            $this->logger = $logger;
        } else {
            $this->logger = new NullLogger();
        }

        return $this->logger;
    }