SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | - | $logPath = __DIR__ . "/" . date("Y-m-d") . "-error.log"; |
3 | + | $$logPath = __DIR__ . "/" . date("Y-m-d") . "-error.log"; |
4 | - | error_log('Sent to my custom log', 3, $logPath); |
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 | ?> |