aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2016-12-03 22:32:19 +0100
committerChristian Weiske <cweiske@cweiske.de>2016-12-03 22:32:19 +0100
commit7b5b3205558717de474a2e77b8b3eea768a38f0e (patch)
tree00a5224b0f1dd51987fc10b81c1ab1acdd90d881
parent6c95d7fe170a54449755a8b571a191a3aaaf954e (diff)
downloadphinde-7b5b3205558717de474a2e77b8b3eea768a38f0e.tar.gz
phinde-7b5b3205558717de474a2e77b8b3eea768a38f0e.zip
add log file supportv0.2.1
-rw-r--r--data/config.php.dist2
-rw-r--r--src/phinde/Log.php11
2 files changed, 12 insertions, 1 deletions
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";
+ }
}
}
?>