summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-06-15 10:43:39 +0000
committerDries Buytaert <dries@buytaert.net>2001-06-15 10:43:39 +0000
commit1045715f4486809993c679a2d09c993c15ef9d93 (patch)
tree22f02582dca470c6701293bd8be423ca6d6dd03a /modules
parentabcef73d19d8925a076d2bdadede933ed354141d (diff)
downloadbrdo-1045715f4486809993c679a2d09c993c15ef9d93.tar.gz
brdo-1045715f4486809993c679a2d09c993c15ef9d93.tar.bz2
- Added very basic 'filters' to the watchdog.module which should make it
easier to sort through all the watchdog "noise". I'm sure the current filters will do for 99% of all the Drupal sites though. (Sorry for the awful color scheme, Coney but I can't do any better.)
Diffstat (limited to 'modules')
-rw-r--r--modules/account.module2
-rw-r--r--modules/watchdog.module17
-rw-r--r--modules/watchdog/watchdog.module17
3 files changed, 19 insertions, 17 deletions
diff --git a/modules/account.module b/modules/account.module
index 62a9cb85d..4d81235da 100644
--- a/modules/account.module
+++ b/modules/account.module
@@ -152,7 +152,7 @@ function account_edit_save($name, $edit) {
}
}
- watchdog("message", "account: modified user '$name'");
+ watchdog("account", "account: modified user '$name'");
}
function account_edit($name) {
diff --git a/modules/watchdog.module b/modules/watchdog.module
index e9ad84e87..761ae43b9 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -17,16 +17,17 @@ function watchdog_cron() {
db_query("DELETE FROM watchdog WHERE ". time() ." - timestamp > ". variable_get("watchdog_clear", 604800));
}
-function watchdog_overview() {
- $colors = array(message => "#FFFFFF", special => "#836FFF", warning => "#FFAA22", httpd => "#77BB77", error => "#EE2C2C");
+function watchdog_overview($type) {
+ $color = array(account => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C");
+ $query = array(account => "WHERE type = 'account'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'");
- $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id ORDER BY timestamp DESC LIMIT 1000");
+ $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>date</TH><TH>message</TH><TH>user</TH><TH>operations</TH></TR>\n";
while ($watchdog = db_fetch_object($result)) {
- if ($color = $colors[$watchdog->type]) {
- $output .= " <TR BGCOLOR=\"$color\"><TD>". format_date($watchdog->timestamp) ."</TD><TD>". substr(check_output($watchdog->message), 0, 50) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
+ if ($background = $color[$watchdog->type]) {
+ $output .= " <TR BGCOLOR=\"$background\"><TD>". format_date($watchdog->timestamp, "small") ."</TD><TD>". substr(check_output($watchdog->message), 0, 50) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
}
}
$output .= "</TABLE>\n";
@@ -52,9 +53,9 @@ function watchdog_view($id) {
}
function watchdog_admin() {
- global $op, $id, $order;
+ global $op, $id, $type, $order;
- print "<SMALL><A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
+ print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=message\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
case "help":
@@ -64,7 +65,7 @@ function watchdog_admin() {
print watchdog_view(check_input($id));
break;
default:
- print watchdog_overview();
+ print watchdog_overview($type);
}
}
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index e9ad84e87..761ae43b9 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -17,16 +17,17 @@ function watchdog_cron() {
db_query("DELETE FROM watchdog WHERE ". time() ." - timestamp > ". variable_get("watchdog_clear", 604800));
}
-function watchdog_overview() {
- $colors = array(message => "#FFFFFF", special => "#836FFF", warning => "#FFAA22", httpd => "#77BB77", error => "#EE2C2C");
+function watchdog_overview($type) {
+ $color = array(account => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C");
+ $query = array(account => "WHERE type = 'account'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'");
- $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id ORDER BY timestamp DESC LIMIT 1000");
+ $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id ". ($type ? $query[$type] : "") ." ORDER BY timestamp DESC LIMIT 1000");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>date</TH><TH>message</TH><TH>user</TH><TH>operations</TH></TR>\n";
while ($watchdog = db_fetch_object($result)) {
- if ($color = $colors[$watchdog->type]) {
- $output .= " <TR BGCOLOR=\"$color\"><TD>". format_date($watchdog->timestamp) ."</TD><TD>". substr(check_output($watchdog->message), 0, 50) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
+ if ($background = $color[$watchdog->type]) {
+ $output .= " <TR BGCOLOR=\"$background\"><TD>". format_date($watchdog->timestamp, "small") ."</TD><TD>". substr(check_output($watchdog->message), 0, 50) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
}
}
$output .= "</TABLE>\n";
@@ -52,9 +53,9 @@ function watchdog_view($id) {
}
function watchdog_admin() {
- global $op, $id, $order;
+ global $op, $id, $type, $order;
- print "<SMALL><A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
+ print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=message\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
case "help":
@@ -64,7 +65,7 @@ function watchdog_admin() {
print watchdog_view(check_input($id));
break;
default:
- print watchdog_overview();
+ print watchdog_overview($type);
}
}