Browse Source

add error log

stanley-king 9 years ago
parent
commit
a17cc27d7a
2 changed files with 11 additions and 1 deletions
  1. 10 0
      core/framework/libraries/log.php
  2. 1 1
      core/framework/libraries/model.php

+ 10 - 0
core/framework/libraries/log.php

@@ -37,6 +37,10 @@ class Log
             $content = "[{$now}] {$level}: {$message}\r\n";
             file_put_contents($log_file, $content, FILE_APPEND);
         }
+
+        if($lev == self::ERR) {
+            self::msg();
+        }
 //        else
 //        {
 //            $level = self::get_level($lev);
@@ -68,6 +72,12 @@ class Log
         }
     }
 
+    public static function msg()
+    {
+        $debugInfo = debug_backtrace();
+        var_dump($debugInfo);
+    }
+
     private static function get_level($lev)
     {
         if($lev == self::INFO) return 'INFO';

+ 1 - 1
core/framework/libraries/model.php

@@ -1161,7 +1161,7 @@ class ModelDb
 
     protected function parseDistinct($distinct) {
         $ret = !empty($distinct)?   ' DISTINCT '.$distinct.',' :'';
-        Log::record("parseDistinct ret = {$ret}");
+        Log::record("parseDistinct ret = {$ret}",Log::DEBUG);
         return $ret;
         //return !empty($distinct)?   ' DISTINCT '.$distinct.',' :'';
     }