Piotr Labudda 9 lat temu
rodzic
commit
bc53e63ce2
2 zmienionych plików z 8 dodań i 3 usunięć
  1. 4 0
      SE/se-lib/DBG.php
  2. 4 3
      SE/se-lib/Route/Debug.php

+ 4 - 0
SE/se-lib/DBG.php

@@ -289,6 +289,10 @@ class DBG {
 			debug_print_backtrace();
 			$logInfo['trace'] = ob_get_clean();
 		}
+		if (!empty($logInfo['trace'])) {// 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);
+		}
 		$logInfo['trace'] = str_replace(APP_PATH_ROOT, 'SE', $logInfo['trace']);
 		$logInfo['trace'] .= (("\n" == substr($logInfo['trace'], -1)) ? '' :  "\n") . "URI: " . V::get('REQUEST_URI', '', $_SERVER);
 		if (!$logInfo['type']) $logInfo['type'] = 'unknown';

+ 4 - 3
SE/se-lib/Route/Debug.php

@@ -227,7 +227,7 @@ class Route_Debug extends RouteBase {
             'log' => UI::h('div', [], [
               UI::h('div', [
                 'title' => htmlspecialchars( ('sql' == $dbg['type'] && is_string($dbg['log'])) ? $dbg['log'] : var_export($dbg['log'], true) ),
-                'onClick' => "return p5DBG__showLogTrace(this, event)",
+                'onClick' => "return p5DBG__showLogTrace(this, event, '600px')",
                 'style' => "cursor:pointer"
               ], str_replace(array('\n', '\t'), ' ', substr(htmlspecialchars(json_encode($dbg['log'])), 0, 100)) . ' ...')
             ]),
@@ -247,7 +247,8 @@ class Route_Debug extends RouteBase {
       ),
     ]);
     echo UI::h('script', [], "
-      function p5DBG__showLogTrace(n, e) {
+      function p5DBG__showLogTrace(n, e, maxWidth) {
+        var maxWidth = maxWidth || null
         if (!e) return false;
         if (e.target && 'PRE' == e.target.tagName) return false;
         var preNode = n.parentNode.lastChild
@@ -260,7 +261,7 @@ class Route_Debug extends RouteBase {
         } else {
           var pre = document.createElement('pre')
           pre.appendChild( document.createTextNode(n.title) )
-          pre.style.maxWidth = '600px'
+          if (maxWidth) pre.style.maxWidth = maxWidth
           pre.style.fontSize = 'x-small'
           n.parentNode.appendChild(pre)
         }