From 0269dccacb67f25beb39dac8f16fb3d5538c7782 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Wed, 4 Jun 2014 11:04:21 +0200 Subject: Little improvement for the logging function. Log spamers into the logs file. --- utils.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'utils.php') diff --git a/utils.php b/utils.php index e622642..20a8088 100644 --- a/utils.php +++ b/utils.php @@ -19,6 +19,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +require_once 'config.php'; + function match_ipv4($ip) { return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); } @@ -59,4 +61,10 @@ function match_aspath_regex($aspath_regex) { return true; } +function log_to_file($log) { + $log = '['.date("Y-m-d H:i:s").'] '.$log."\n"; + file_put_contents($config['misc']['logs'], $log, FILE_APPEND | LOCK_EX); +} + + // End of utils.php -- cgit v1.2.3