Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 12th, 2012  |  syntax: PHP  |  size: 0.36 KB  |  views: 45  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. $$logPath = __DIR__ . "/" . date("Y-m-d") . "-error.log";
  4. error_log('My Current log Message', 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.  
  14. ?>