From e4e95a3a8540720010c499753221181daedcb840 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 19 Mar 2012 21:19:50 +0000 Subject: [PATCH] suppress the flood of 'suppressing flood' messages... --- contrib/log_net/main.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/contrib/log_net/main.php b/contrib/log_net/main.php index a9c69b11..4cde7c56 100644 --- a/contrib/log_net/main.php +++ b/contrib/log_net/main.php @@ -13,15 +13,17 @@ class LogNet extends Extension { public function onLog(LogEvent $event) { global $user; - if($this->count < 10 && $event->priority > 10) { - // TODO: colour based on event->priority - $username = ($user && $user->name) ? $user->name : "Anonymous"; - $str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message); - system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); - $this->count++; - } - else { - system("echo 'suppressing flood, check the web log' | nc -q 0 localhost 5000"); + if($event->priority > 10) { + if($this->count < 10) { + // TODO: colour based on event->priority + $username = ($user && $user->name) ? $user->name : "Anonymous"; + $str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message); + system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); + $this->count++; + } + else { + system("echo 'suppressing flood, check the web log' | nc -q 0 localhost 5000"); + } } } }