|
|
@@ -328,11 +328,32 @@ class DBG {
|
|
|
}
|
|
|
if (!empty($logInfo['trace']) && 'Exception' !== $logInfo['type']) {// remove #0 and #1 (DBG::log and DBG::_log)
|
|
|
$pos = strpos($logInfo['trace'], "\n#2");
|
|
|
- if (false !== $pos) $logInfo['trace'] = substr($logInfo['trace'], $pos + 1);
|
|
|
+ // if (false !== $pos) $logInfo['trace'] = substr($logInfo['trace'], $pos + 1); // TODO
|
|
|
}
|
|
|
$logInfo['trace'] = str_replace(APP_PATH_ROOT, 'SE', $logInfo['trace']);
|
|
|
- $logInfo['trace'] .= (("\n" == substr($logInfo['trace'], -1)) ? '' : "\n") . "URI: " . V::get('REQUEST_URI', '', $_SERVER);
|
|
|
+ $logInfo['trace'] .= (("\n" == substr($logInfo['trace'], -1)) ? '' : "\n") . "#URI: " . V::get('REQUEST_URI', '', $_SERVER);
|
|
|
if (!$logInfo['type']) $logInfo['type'] = 'unknown';
|
|
|
+
|
|
|
+ if (!empty($logInfo['trace'])) {
|
|
|
+ $trace = array_map(function ($part) {
|
|
|
+ if ('URI: ' === substr($part, 0, strlen('URI: '))) return "#{$part}";
|
|
|
+ if ($pos = strrpos($part, ' called at [')) {
|
|
|
+ $spacePos = strpos($part, ' ');
|
|
|
+ $spacePos = (' ' === $part[$spacePos + 1]) ? $spacePos + 1 : $spacePos;
|
|
|
+ $spacePos = (' ' === $part[$spacePos + 1]) ? $spacePos + 1 : $spacePos;
|
|
|
+ $spacePos += 1;
|
|
|
+ $called = substr($part, $pos + strlen(' called at ['), -1);
|
|
|
+ $nr = substr($part, 0, $spacePos);
|
|
|
+ $line = substr($part, $spacePos, ($pos > 300) ? 300 : $pos - $spacePos);
|
|
|
+ $line = str_replace("\n", '\\n', $line);
|
|
|
+ return "#{$nr}{$called}: {$line}";
|
|
|
+ }
|
|
|
+ return $part;
|
|
|
+ }, explode("\n#", $logInfo['trace']));
|
|
|
+ array_shift($trace);
|
|
|
+ $logInfo['trace'] = implode("\n", $trace);
|
|
|
+ }
|
|
|
+
|
|
|
error_log(
|
|
|
json_encode($logInfo) . "\n"
|
|
|
, 3
|