summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2020-05-12 17:30:36 +0200
committerUrban Müller2020-05-12 17:30:36 +0200
commit86786178c0bca29d05b4afc8799633dfb23fc842 (patch)
treec7e6bcd441e159f620fa159efc3f9506a4792fde /it.class
parent0c395bdaad21a82aaf45319497acfe93b8c21747 (diff)
downloaditools-86786178c0bca29d05b4afc8799633dfb23fc842.tar.gz
itools-86786178c0bca29d05b4afc8799633dfb23fc842.tar.bz2
itools-86786178c0bca29d05b4afc8799633dfb23fc842.zip
compactify error mails
Diffstat (limited to 'it.class')
-rw-r--r--it.class12
1 files changed, 5 insertions, 7 deletions
diff --git a/it.class b/it.class
index a4341ae..97a2e5d 100644
--- a/it.class
+++ b/it.class
@@ -256,10 +256,9 @@ static function error($p = array())
}
$body =
- ($p['omitdebuginfo'] >= 2 ? "" : ($url && !$toscreen? "{$p['title']}\n\nUrl: $url\n\n" : "") .
- ($trace ? ($sendmail ? "" : " ") . "Trace: $trace\n\n" : "")) .
- (!$sendmail || $p['omitdebuginfo'] >= 2 ? "" : "Host: " . getenv('HOSTNAME') . "\n\n") .
- (!$sendmail || $p['omitdebuginfo'] >= 2 ? "" : "Time: " . date("Y-m-d H:i:s") . (($t = time() - $_SERVER['REQUEST_TIME']) ? " (invoked {$t}s before)" : "") . "\n\n") . # no it::date() due to time- debug param
+ ($p['omitdebuginfo'] >= 2 ? "" : ($url && !$toscreen? "{$p['title']}\nUrl: $url\n" : "") .
+ ($trace ? ($sendmail ? "" : " ") . "Trace: $trace\n" : "")) .
+ (!$sendmail || $p['omitdebuginfo'] >= 2 ? "" : "Host: " . getenv('HOSTNAME') . " at " . date("Y-m-d H:i:s") . (($t = time() - $_SERVER['REQUEST_TIME']) ? " (invoked {$t}s before)" : "") . "\n") . # no it::date() due to time- debug param
self::$error_context .
($p['body'] ? ($p['omitdebuginfo'] ? "" : "Body:\n") . trim($p['body'])."\n\n" : "");
@@ -273,9 +272,8 @@ static function error($p = array())
if ($level >= $p['backtraceskip'] && $tracesize < 100000 && ($tracesize += strlen(print_r($stackframe, true))) < 100000) # save mem
$stackframes[] = $stackframe;
- $body .= $p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . " (previous err: " . it::date('', $errstamp) . ")\n\n" : "";
- $body .= $origp['blockmail'] ? "Block-resend: " . $origp['blockmail'] . " seconds\n\n" : "";
- $body .= !$trace ? "" : "Overview: ssh " . getenv('HOSTNAME') . " 'cat /tmp/alertdata/alertlog | fgrep \"" . it::replace(["'" => " "], $trace) . "\"'\n\n";
+ $body .= $p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . " (previous err: " . it::date('', $errstamp) . ")\n" : "";
+ $body .= $origp['blockmail'] ? "Block-resend: " . $origp['blockmail'] . " seconds\n" : "";
$body .= ($trace and $t = it::exec('grep -h {0} `ls /tmp/alertdata/alertlog-*|tail -3` /dev/null 2>/dev/null | grep ^2 | cut -d : -f 1-2 | sort | uniq -c | tail -10', $trace)) ? "Histogram: (last 10 affected minutes in 3 days)\n$t\n" : "";
$body .= $_GET ? "\$_GET: " . var_export($_GET, true) . "\n\n" : "";
$body .= $_POST ? "\$_POST: " . var_export($_POST, true) . "\n\n" : "";