public function __construct() { if (!file_exists("./log_files")) { mkdir('./log_files'); } $this->log_file = "./log_files/Log.txt"; if (file_exists($this->log_file)) { if (filesize($this->log_file) >= MD_LOG_FILE_SIZE) { unlink($this->log_file); } } Analog::handler(Analog\Handler\File::init($this->log_file)); }
public function __construct() { $this->path = MD_ROOT . "/log_files"; if (!file_exists($this->path)) { mkdir($this->path); } $this->log_file = $this->path . "/ErrorLog.txt"; if (file_exists($this->log_file)) { if (filesize($this->log_file) >= MD_LOG_FILE_SIZE) { unlink($this->log_file); } } Analog::handler(Analog\Handler\File::init($this->log_file)); }
public function __construct($message = null, $code = 0) { if (!file_exists("./log_files")) { mkdir('./log_files'); } $this->log_file = './log_files/Log.txt'; if (!$message) { throw new $this('Unknown ' . get_class($this)); } Analog::handler(Analog\Handler\File::init($this->log_file)); parent::__construct($message, $code); Analog::log($this->__toString(), Analog::ERROR); $handleFilesFolder = new HandleFilesFolder(); $handleFilesFolder->handle(); if (file_exists("FTP_SEMAMPHORE.smph")) { unlink("FTP_SEMAMPHORE.smph"); } }
public function __construct($message = "Unknown error", $code = 0) { if (!file_exists(MD_LOG_FILE_DIR)) { mkdir(MD_LOG_FILE_DIR); } $this->log_file = MD_LOG_FILE_DIR . '/Log.txt'; if (!$message) { throw new $this('Unknown ' . get_class($this)); } Analog::handler(Analog\Handler\File::init($this->log_file)); if (gettype($message) !== "string") { $message = "Unknown error"; } parent::__construct($message, 10); Analog::log($this->__toString(), Analog::ERROR); $handleFilesFolder = new HandleFilesFolder(); $handleFilesFolder->handle(); if (file_exists(MD_ROOT . "/FTP_SEMAMPHORE.smph")) { unlink(MD_ROOT . "/FTP_SEMAMPHORE.smph"); } }
<?php require '../lib/Analog.php'; $log_file = 'log.txt'; Analog::handler(Analog\Handler\File::init($log_file)); Analog::log('foo'); Analog::log('bar'); echo file_get_contents($log_file); unlink($log_file);