summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2021-03-12 16:16:14 +0100
committerUrban Müller2021-03-12 16:16:14 +0100
commita8a79ede824088ecb1aee300b04c2cd96b8f1399 (patch)
tree88dcfc378ea27e1dcc3138358283b1214a907a60
parent9eb57908a66a9090f33fc87a6376880d50708ee8 (diff)
downloaditools-a8a79ede824088ecb1aee300b04c2cd96b8f1399.tar.gz
itools-a8a79ede824088ecb1aee300b04c2cd96b8f1399.tar.bz2
itools-a8a79ede824088ecb1aee300b04c2cd96b8f1399.zip
allow forcing errors to screen
-rw-r--r--it.class8
1 files changed, 5 insertions, 3 deletions
diff --git a/it.class b/it.class
index 1a54a58..723a202 100644
--- a/it.class
+++ b/it.class
@@ -21,7 +21,7 @@
class it
{
-static $error_context; # Text that will be added to all it_error mails
+static $error_context; # Callback, can provide $result['head'] and $result['toscreen']
/**
* Create config class with static members initialized (e.g. $home).
@@ -207,7 +207,9 @@ static function error($p = array(), $extra = null)
return;
}
- $toscreen = getenv('NOERRORMAILS') || ini_get('display_errors') || (defined("STDOUT") && posix_isatty(STDERR)) || EDC('astwin') || EDC('asdevel');
+ $context = is_callable(self::$error_context) ? (self::$error_context)() : [];
+
+ $toscreen = getenv('NOERRORMAILS') || ini_get('display_errors') || (defined("STDOUT") && posix_isatty(STDERR)) || EDC('astwin') || EDC('asdevel') || $context['toscreen'];
if ($toscreen && !it::is_live())
$GLOBALS['debug_noredir'] = 1;
@@ -263,7 +265,7 @@ static function error($p = array(), $extra = null)
($p['omitdebuginfo'] >= 2 ? "" : ($url && !$toscreen? "Title: {$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
- ($sendmail ? self::$error_context : "") .
+ ($sendmail ? $context['head'] : "") .
($p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . " (previous err: " . it::date('', $errstamp) . ")\n" : "") .
(!$origp['blockmail'] || $p['omitdebuginfo'] || $toscreen ? "" : "Block-resend: " . $origp['blockmail'] . " seconds\n") .
($p['body'] ? ($p['omitdebuginfo'] ? "" : "Body:\n") . trim($p['body'])."\n\n" : "");