<?php
$$logPath = __DIR__ . "/" . date("Y-m-d") . "-error.log";
error_log('My Current log Message', 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);
}
?>