diff options
author | Urban Müller | 2013-12-13 14:54:29 +0100 |
---|---|---|
committer | Urban Müller | 2013-12-13 14:54:29 +0100 |
commit | b137df0d3cad750aa0a314a8f0c050bc14c162dd (patch) | |
tree | 25e50558f1b5bd35b6503fbe6538cb8f35a8bf25 /it.class | |
parent | ee68e001936050a0999bb3fcc12d87fa2fe04bf4 (diff) | |
download | itools-b137df0d3cad750aa0a314a8f0c050bc14c162dd.tar.gz itools-b137df0d3cad750aa0a314a8f0c050bc14c162dd.tar.bz2 itools-b137df0d3cad750aa0a314a8f0c050bc14c162dd.zip |
it::error: better ok state filenames, warning fix, extra terse mode
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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 { |