private function setupLogger()
    {
        $this->log = new Logger('philip');
        if (isset($this->config['debug']) && $this->config['debug'] == true) {
            $log_path = isset($this->config['log']) ? $this->config['log'] : false;

            if (!$log_path) {
                throw new \Exception("If debug is enabled, you must supply a log file location.");
            }

            try {
                $format = "[%datetime% - %level_name%]: %message%";
                $handler = new StreamHandler($log_path, Logger::DEBUG);
                $handler->setFormatter(new LineFormatter($format));
                $this->log->pushHandler($handler);
            } catch (\Exception $e) {
                throw new \Exception("Unable to open/read log file.");
            }
        } else {
            $this->log->pushHandler(new NullHandler());
        }
    }