/** * @param $info * @param string $file * @return bool */ public function logger($info, $file = "default.log") { if(!$this->log) return false; $baseUrl = str_replace('\', DIRECTORY_SEPARATOR, realpath(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/')) . '/'; $path = explode('.', $file); $path = $path[0]; if(!is_dir($baseUrl.'/../var/log/'.$path)){ mkdir($baseUrl.'/../var/log/'.$path,0755); } $file = $path."-".date('Y-m-d',time()).'.'.pathinfo($file)['extension']; /** * @var $writer endLogWriterStream * @var $logger endLogLogger */ $writer = new endLogWriterStream(BP.'/var/log/'.$path.'/'.$file); $logger = new endLogLogger(); $logger->addWriter($writer); $logger->info(json_encode($info)); }