fileOpened) { $this->openFile(); } if (empty($msg)) { fwrite($this->f, PHP_EOL); } else { fwrite($this->f, date('[Y-m-d H:i:s] ') . $msg . PHP_EOL); } } protected function __construct() { $this->openFile(); } protected function openFile() { if ($this->f = fopen(dirname(__FILE__) . '/../' . 'arseopro.log', 'a+')) { $this->fileOpened = true; } } protected function closeFile() { if (!empty($this->f)) { fclose($this->f); } $this->fileOpened = false; } public function __destruct() { $this->closeFile(); } }