规范日志记录级别

This commit is contained in:
thinkphp
2015-12-21 08:37:09 +08:00
parent b209bf5978
commit e2bf69ddb1
4 changed files with 6 additions and 6 deletions

View File

@@ -106,7 +106,7 @@ abstract class Driver
$this->linkID[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $this->options); $this->linkID[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $this->options);
} catch (\PDOException $e) { } catch (\PDOException $e) {
if ($autoConnection) { if ($autoConnection) {
Log::record($e->getMessage(), 'ERR'); Log::record($e->getMessage(), 'error');
return $this->connect($autoConnection, $linkNum); return $this->connect($autoConnection, $linkNum);
} elseif ($config['debug']) { } elseif ($config['debug']) {
throw new Exception($e->getMessage()); throw new Exception($e->getMessage());
@@ -373,7 +373,7 @@ abstract class Driver
$this->error .= "\n [ SQL语句 ] : " . $this->queryStr; $this->error .= "\n [ SQL语句 ] : " . $this->queryStr;
} }
// 记录错误日志 // 记录错误日志
Log::record($this->error, 'ERR'); Log::record($this->error, 'error');
if ($this->config['debug']) { if ($this->config['debug']) {
// 开启数据库调试模式 // 开启数据库调试模式
throw new Exception($this->error); throw new Exception($this->error);

View File

@@ -195,7 +195,7 @@ class Mongo extends Driver
public function error() public function error()
{ {
$this->error = $this->_mongo->lastError(); $this->error = $this->_mongo->lastError();
Log::record($this->error, 'ERR'); Log::record($this->error, 'error');
return $this->error; return $this->error;
} }

View File

@@ -103,7 +103,7 @@ class Lite
$this->linkID[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $config['params']); $this->linkID[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $config['params']);
} catch (\PDOException $e) { } catch (\PDOException $e) {
if ($autoConnection) { if ($autoConnection) {
Log::record($e->getMessage(), 'ERR'); Log::record($e->getMessage(), 'error');
return $this->connect($autoConnection, $linkNum); return $this->connect($autoConnection, $linkNum);
} elseif ($config['debug']) { } elseif ($config['debug']) {
throw new Exception($e->getMessage()); throw new Exception($e->getMessage());
@@ -363,7 +363,7 @@ class Lite
$this->error .= "\n [ SQL语句 ] : " . $this->queryStr; $this->error .= "\n [ SQL语句 ] : " . $this->queryStr;
} }
// 记录错误日志 // 记录错误日志
Log::record($this->error, 'ERR'); Log::record($this->error, 'error');
if ($this->config['debug']) { if ($this->config['debug']) {
// 开启数据库调试模式 // 开启数据库调试模式
throw new Exception($this->error); throw new Exception($this->error);

View File

@@ -262,7 +262,7 @@ class Loader
if (class_exists($class)) { if (class_exists($class)) {
$model = new $class($name); $model = new $class($name);
} else { } else {
Log::record('实例化不存在的类:' . $class, 'NOTIC'); Log::record('实例化不存在的类:' . $class, 'warn');
$model = new Model($name); $model = new Model($name);
} }
} }