Exemple #1
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new eLogs();
     }
     return self::$instance;
 }
Exemple #2
0
 function writeLogFile($sql, $valueList = null, $call_pos = '', $filePrefix = '')
 {
     /*add by ngannv*/
     $sqlStr = $sql;
     if ($valueList) {
         $valueArray = array_map('mysql_real_escape_string', $valueList);
         self::$sqlStr = vsprintf($sqlStr, $valueArray);
     }
     if (preg_match("/^select/i", $sql)) {
         $filePrefix .= 'select_';
     } elseif (preg_match("/^delete/i", $sql)) {
         $filePrefix .= 'delete_';
     } elseif (preg_match("/^update/i", $sql)) {
         $filePrefix .= 'update_';
     } elseif (preg_match("/^insert/i", $sql)) {
         $filePrefix .= 'insert_';
     } elseif (preg_match("/^show/i", $sql)) {
         $filePrefix .= 'show_';
     } elseif (preg_match("/^truncate/i", $sql)) {
         $filePrefix .= 'truncate_';
     }
     $mod = Module::$name;
     if (!$mod) {
         $mod = '_SYSTEM_';
     }
     $mod = 'Module:' . $mod;
     eLogs::writeLogFile('SQL Run at: ' . $mod . ':' . $call_pos . "\n" . $sqlStr, $filePrefix);
 }