From 409a3b9b23f2797b4e0420bcb06488a68ccd5962 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 26 Feb 2012 15:24:37 +0000 Subject: [PATCH] network logging, for irccat --- .gitignore | 1 + contrib/log_net/main.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 contrib/log_net/main.php diff --git a/.gitignore b/.gitignore index b4ced277..fdcffdfa 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ ext/image_hash_ban ext/ipban ext/link_image ext/log_db +ext/log_net ext/mass_tagger ext/news ext/notes diff --git a/contrib/log_net/main.php b/contrib/log_net/main.php new file mode 100644 index 00000000..a35ea54a --- /dev/null +++ b/contrib/log_net/main.php @@ -0,0 +1,21 @@ + + * Link: http://code.shishnet.org/shimmie2/ + * Description: Send log events to a network port. + * Visibility: admin + */ + +class LogNet extends Extension { + public function onLog(LogEvent $event) { + global $user; + + if($event->priority > 10) { + $username = ($user && $user->name) ? $user->name : "Anonymous"; + $str = sprintf("%2d %15s (%s): %s - %s", $event->priority, $_SERVER['REMOTE_ADDR'], $username, $event->section, $event->message); + system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); + } + } +} +?>