Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $logPath = __DIR__ . "/" . date("Y-m-d") . "-error.log";
- error_log('Sent to my custom log', 3, $logPath);
- delete_log(dirname($logPath));
- function delete_log($logPath, $olderThan = 600) {
- $it = new GlobIterator($logPath . "/*.log");
- $list = array();
- foreach ( $it as $file )
- (time() - $file->getMTime()) >= $olderThan and unlink($file);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement