Advertisement
Guest User

Untitled

a guest
Nov 12th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. <?php
  2.  
  3. $logPath = __DIR__ . "/" . date("Y-m-d") . "-error.log";
  4. error_log('Sent to my custom log', 3, $logPath);
  5. delete_log(dirname($logPath));
  6.  
  7. function delete_log($logPath, $olderThan = 600) {
  8.     $it = new GlobIterator($logPath . "/*.log");
  9.     $list = array();
  10.     foreach ( $it as $file )
  11.         (time() - $file->getMTime()) >= $olderThan and unlink($file);
  12. }
  13. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement