/** * 构造函数,设置文件位置和过滤级别 * @param string $name 日志名称 * @param string $directory 日志目录 * @param string $threshold 过滤级别(低于本级别的不记录) */ public function __construct($name = '', $directory = false, $threshold = false) { $this->filename = ($name ? $name . '_' : '') . '%s.log'; if ($directory === false) { $directory = realpath('./logs'); } if (is_dir($directory) || mkdir($directory, 0777, true)) { $this->filename = $directory . DIRECTORY_SEPARATOR . $this->filename; } parent::__construct($threshold); $this->defer(); }
function __construct($A = '', $r = false, $hC = false) { $this->filename = ($A ? $A . '_' : '') . '%s.log'; if ($r === false) { $r = realpath('./logs'); } if (is_dir($r) || mkdir($r, 0777, true)) { $this->filename = $r . DIRECTORY_SEPARATOR . $this->filename; } parent::__construct($hC); $this->defer(); }