diff options
author | Urban Müller | 2023-11-16 16:44:50 +0100 |
---|---|---|
committer | Urban Müller | 2023-11-16 16:44:50 +0100 |
commit | 5dedcb92a63094351bf00f94cc0691c82ed4a2d4 (patch) | |
tree | ee7ed40c423de80c43435db05dc6aba61827be35 /it.class | |
parent | 970b9b5417ada8ea4f0c296f8d9c4ac1b1f648a4 (diff) | |
download | itools-5dedcb92a63094351bf00f94cc0691c82ed4a2d4.tar.gz itools-5dedcb92a63094351bf00f94cc0691c82ed4a2d4.tar.bz2 itools-5dedcb92a63094351bf00f94cc0691c82ed4a2d4.zip |
add mailid to alertlog for grepping
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -208,6 +208,7 @@ static function error($p = array(), $extra = null) list($p['graceperiod'], $p['timewindow']) = [$parts[0], $parts[1] - $parts[0]]; $p += array('blockmailid' => $GLOBALS['ULTRASITE'] . "." . md5($p['to'])); $traceline = it_debug::backtrace(['skiplevels' => $p['backtraceskip'] + ($p['trace'] ? 0 : 1), 'skipfiles' => $p['skipfiles'], 'trace' => $p['trace']]); + $mailid = sprintf("mail%04d", crc32($traceline ?: $p['title']) % 10000); @mkdir("/tmp/alertdata"); @chmod("/tmp/alertdata", 0777); @@ -273,8 +274,6 @@ static function error($p = array(), $extra = null) $p['body'] = " See " . getenv('HOSTNAME') . ":$datafn"; } - $mailid = sprintf("mail%04d", crc32($traceline ?: $p['title']) % 10000); - $body = ($p['omitdebuginfo'] >= 2 ? "" : ($url && !$toscreen? "Title: {$p['title']}\nUrl: $url\n" : "") . ($traceline ? ($sendmail ? "" : " ") . "Trace: $traceline\n" : "")) . @@ -342,7 +341,7 @@ static function error($p = array(), $extra = null) if ($_SERVER['REMOTE_ADDR']) # additional entry in log/error_log error_log("it::error: " . $p['title'] . " Url: $url"); - it::log("alertlog", $p['title'] . " in " . ($traceline ? $traceline : "{$p['file']}:{$p['line']}") . " Url: $url" . ($p['body'] ? "\n" . substr(D($p['body']), 0, 5000) . "\n" : "")); + it::log("alertlog", $p['title'] . " ($mailid) in " . ($traceline ? $traceline : "{$p['file']}:{$p['line']}") . " Url: $url" . ($p['body'] ? "\n" . substr(D($p['body']), 0, 5000) . "\n" : "")); return $p['fatal'] ? self::_exit($p) : null; } |