Ver código fonte

debug dblock

stanley-king 8 anos atrás
pai
commit
22809f8773
2 arquivos alterados com 19 adições e 3 exclusões
  1. 18 2
      core/framework/libraries/model.php
  2. 1 1
      helper/http_header.php

+ 18 - 2
core/framework/libraries/model.php

@@ -4,6 +4,23 @@
  *
  * 模型类
  */
+class trans_log
+{
+    private $mName;
+    private $mStart;
+    public function __construct($name)
+    {
+        $this->mStart = microtime(true);
+        $this->mName = $name;
+        Log::record("trans_log start {$name}");
+    }
+
+    public function __destruct()
+    {
+        $msg = sprintf("trans_log end {$this->mName} use_time=%.6f",microtime(true) - $this->mStart);
+        Log::record($msg);
+    }
+}
 
 class Model
 {
@@ -24,7 +41,7 @@ class Model
 	}
 	public function __destruct()
     {
-        Log::record("{$this->table_name} __destruct",Log::DEBUG);
+        //Log::record("{$this->table_name} __destruct",Log::DEBUG);
     }
 
     public function init($table)
@@ -674,7 +691,6 @@ class Model
     public function checkActive($host = 'master') {
         $this->db->checkActive($host);
     }
-
 }
 
 

+ 1 - 1
helper/http_header.php

@@ -335,7 +335,7 @@ function init_cookie($cookie)
                 if(!empty($k)) {
                     $_COOKIE[$k] = $v;
                 }
-                Log::record("cookie {$k} = {$v}",Log::DEBUG);
+                //Log::record("cookie {$k} = {$v}",Log::DEBUG);
             }
         }
     }