81 $this->directory = rtrim($realPath,
'/') .
'/';
83 $this->directory =
false;
102 $theLevel = (int)$level;
103 if ( $theLevel >= 0 && $theLevel <= 4 ) {
104 $this->level = $theLevel;
106 throw new InvalidArgumentException(
'Invalid Log Level. Must be one of: 0, 1, 2, 3, 4.');
168 return $this->
getDirectory() . strftime(
'%Y-%m-%d') .
'.log';
180 if ( $dir ==
false || !is_dir($dir) ) {
181 throw new RuntimeException(
"Log directory '$dir' invalid.");
183 if ( !is_writable($dir) ) {
184 throw new RuntimeException(
"Log directory '$dir' not writable.");
186 if ( $level <= $this->
getLevel() ) {
187 $this->
write(sprintf(
"[%s] %s - %s\r\n", $this->levels[$level], date(
'c'), (
string)
$data));
197 @file_put_contents($this->
getFile(),
$data, FILE_APPEND | LOCK_EX);