Skip to content

Commit

Permalink
Removin use of File class in favor of SplFileObject
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jul 24, 2010
1 parent 43127ca commit 1cfcec9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cake/libs/log/file_log.php
Expand Up @@ -17,9 +17,7 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
if (!class_exists('File')) {
require LIBS . 'file.php';
}

/**
* File Storage stream for Logging. Writes logs to different files
* based on the type of log it is.
Expand Down Expand Up @@ -69,9 +67,9 @@ public function write($type, $message) {
$filename = $this->_path . $type . '.log';
}
$output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $message . "\n";
$log = new File($filename, true);
if ($log->writable()) {
return $log->append($output);
$log = new SplFileObject($filename, 'a+');
if ($log->isWritable()) {
return $log->fwrite($output);
}
}
}

0 comments on commit 1cfcec9

Please sign in to comment.