From: Christian Weiske Date: Sat, 3 Dec 2016 21:32:19 +0000 (+0100) Subject: add log file support X-Git-Tag: v0.2.1 X-Git-Url: https://git.cweiske.de/phinde.git/commitdiff_plain/7b5b3205558717de474a2e77b8b3eea768a38f0e add log file support --- diff --git a/data/config.php.dist b/data/config.php.dist index fff65ce..cef499b 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -15,6 +15,8 @@ $GLOBALS['phinde'] = array( ), //verbose output 'debug' => true, + //full path to log file + 'logfile' => null, //time in seconds after which URLs may be re-indexed 'refreshtime' => 86400, //if directly linked URLs shall be indexed, even if they are diff --git a/src/phinde/Log.php b/src/phinde/Log.php index 2369a2b..cc8cf12 100644 --- a/src/phinde/Log.php +++ b/src/phinde/Log.php @@ -17,7 +17,16 @@ class Log public static function log($msg) { - echo $msg . "\n"; + if (isset($GLOBALS['phinde']['logfile']) + && $GLOBALS['phinde']['logfile'] != '' + ) { + file_put_contents( + $GLOBALS['phinde']['logfile'], + $msg . "\n", FILE_APPEND + ); + } else { + echo $msg . "\n"; + } } } ?>