![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/Corals/modules/Aliexpress/TopSdk/top/ |
<?php class TopLogger { public $conf = array( "separator" => "\t", "log_file" => "" ); private $fileHandle; protected function getFileHandle() { if (null === $this->fileHandle) { if (empty($this->conf["log_file"])) { trigger_error("no log file spcified."); } $logDir = dirname($this->conf["log_file"]); if (!is_dir($logDir)) { mkdir($logDir, 0777, true); } $this->fileHandle = fopen($this->conf["log_file"], "a"); } return $this->fileHandle; } public function log($logData) { if ("" == $logData || array() == $logData) { return false; } if (is_array($logData)) { $logData = implode($this->conf["separator"], $logData); } $logData = $logData. "\n"; fwrite($this->getFileHandle(), $logData); } } ?>