内核更新
This commit is contained in:
@@ -84,7 +84,7 @@ class Log
|
||||
public static function record($msg, $type = 'log')
|
||||
{
|
||||
self::$log[$type][] = $msg;
|
||||
if (IS_CLI && count(self::$log[$type]) > 100) {
|
||||
if (IS_CLI) {
|
||||
// 命令行下面日志写入改进
|
||||
self::save();
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class Log
|
||||
|
||||
/**
|
||||
* 当前日志记录的授权key
|
||||
* @param string $key 授权key
|
||||
* @param string $key 授权key
|
||||
* @return void
|
||||
*/
|
||||
public static function key($key)
|
||||
@@ -111,7 +111,7 @@ class Log
|
||||
|
||||
/**
|
||||
* 检查日志写入权限
|
||||
* @param array $config 当前日志配置参数
|
||||
* @param array $config 当前日志配置参数
|
||||
* @return bool
|
||||
*/
|
||||
public static function check($config)
|
||||
@@ -166,13 +166,14 @@ class Log
|
||||
|
||||
/**
|
||||
* 实时写入日志信息 并支持行为
|
||||
* @param mixed $msg 调试信息
|
||||
* @param string $type 信息类型
|
||||
* @param mixed $msg 调试信息
|
||||
* @param string $type 信息类型
|
||||
* @param bool $force 是否强制写入
|
||||
* @return bool
|
||||
*/
|
||||
public static function write($msg, $type = 'log', $force = false)
|
||||
{
|
||||
$log = self::$log;
|
||||
// 封装日志信息
|
||||
if (true === $force || empty(self::$config['level'])) {
|
||||
$log[$type][] = $msg;
|
||||
@@ -188,7 +189,11 @@ class Log
|
||||
self::init(Config::get('log'));
|
||||
}
|
||||
// 写入日志
|
||||
return self::$driver->save($log, false);
|
||||
$result = self::$driver->save($log);
|
||||
if ($result) {
|
||||
self::$log = [];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user