suppress the flood of 'suppressing flood' messages...

This commit is contained in:
Shish 2012-03-19 21:19:50 +00:00
parent d1e8bfb749
commit e4e95a3a85

View File

@ -13,15 +13,17 @@ class LogNet extends Extension {
public function onLog(LogEvent $event) { public function onLog(LogEvent $event) {
global $user; global $user;
if($this->count < 10 && $event->priority > 10) { if($event->priority > 10) {
// TODO: colour based on event->priority if($this->count < 10) {
$username = ($user && $user->name) ? $user->name : "Anonymous"; // TODO: colour based on event->priority
$str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message); $username = ($user && $user->name) ? $user->name : "Anonymous";
system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); $str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message);
$this->count++; 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"); else {
system("echo 'suppressing flood, check the web log' | nc -q 0 localhost 5000");
}
} }
} }
} }