From b137df0d3cad750aa0a314a8f0c050bc14c162dd Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 13 Dec 2013 14:54:29 +0100 Subject: it::error: better ok state filenames, warning fix, extra terse mode --- it.class | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index a6091e3..d62a57c 100644 --- a/it.class +++ b/it.class @@ -122,7 +122,7 @@ static function timerlog($label = '') * @param $p['blockmailid'] block mail for $p['blockmail'] seconds with same id. Default: $p['to'] * @param $p['okstate'] give current ok label and state, e.g. telresult=1 . see failcount * @param $p['failcount'] give number of consecutive okstate failures needed for creating an error [2] - * @param $p['omitdebuginfo'] Do not add stack dump, locals and environment to output [false] + * @param $p['omitdebuginfo'] value 1 omits long stack and var dumps, value 2 also omits trace and url * @return true if a mail was sent */ static function error($p = array(), $body = null, $to = null) # $body and $to deprecated @@ -155,9 +155,9 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de if ($p['okstate']) { - list($okid, $okstatus) = explode("=", $p['okstate']); - $failcount = $okstatus ? 0 : file_get_contents("/tmp/alertdata/$okid") + 1; - file_put_contents("/tmp/alertdata/$okid", "$failcount\n"); + list($okfn, $okstatus) = explode("=", "/tmp/alertdata/okstate_" . $p['okstate']); + $failcount = $okstatus ? 0 : @file_get_contents($okfn) + 1; + file_put_contents($okfn, "$failcount\n"); if ($failcount != $p['failcount']) return; } @@ -209,7 +209,7 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de $p['body'] = "Body: " . getenv('HOSTNAME') . ":$datafn"; } - $body = ($p['body'] ? trim($p['body'])."\n\n" : "") . ($url && !$toscreen? "{$p['title']}\n\nUrl: $url\n\n" : "") . ($trace ? ($sendmail?"" :" ")."Trace: $trace\n\n" : ""); + $body = ($p['body'] ? trim($p['body'])."\n\n" : "") . ($p['omitdebuginfo'] >= 2 ? "" : ($url && !$toscreen? "{$p['title']}\n\nUrl: $url\n\n" : "") . ($trace ? ($sendmail?"" :" ")."Trace: $trace\n\n" : "")); if ($sendmail) # we're mailing: send maximum info { -- cgit v1.2.3