private function open() { if (!\Sauce\Path::check($this->filename, 'f', 'w')) { if (!($this->file = fopen($this->filename, 'a'))) { throw new \Exception('Log file is not writable (' . $this->filename . ').'); } } else { $this->file = fopen($this->filename, 'a'); } if (!is_resource($this->file)) { throw new \Exception('Log file resource is not valid anymore'); } }