コード例 #1
0
ファイル: Amslib_Database.php プロジェクト: hakosh/amslib
 /**
  * 	method: debug
  *
  * 	todo: write documentation
  */
 protected function debug($type, $data, $params = array())
 {
     //	Type "ERROR" always record into the database, but DEBUG/QUERY, require debugState=true
     if (!$this->debugState && in_array($type, array("DEBUG", "QUERY"))) {
         return null;
     }
     if (!empty($params)) {
         static $param_map = array(0 => "PARAM_NULL", 1 => "PARAM_INT", 2 => "PARAM_STR", 3 => "PARAM_LOB", 4 => "PARAM_STMT", 5 => "PARAM_BOOL");
         $params = Amslib_Array::valid($params);
         $params = Amslib_Array::reindexByKey($params, "0");
         foreach ($params as &$p) {
             $p = Amslib_Array::pluck($p, array("1", "2"));
             $p[2] = $param_map[$p[2]];
         }
     }
     return empty($params) ? Amslib_Debug::log($type, $data) : Amslib_Debug::log($type, $data, $params);
 }