mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
改进Log类的record方法
This commit is contained in:
@@ -80,9 +80,6 @@ class Log
|
|||||||
*/
|
*/
|
||||||
public static function record($msg, $type = 'log')
|
public static function record($msg, $type = 'log')
|
||||||
{
|
{
|
||||||
if (!is_string($msg)) {
|
|
||||||
$msg = var_export($msg, true);
|
|
||||||
}
|
|
||||||
self::$log[$type][] = $msg;
|
self::$log[$type][] = $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,9 +150,6 @@ class Log
|
|||||||
*/
|
*/
|
||||||
public static function write($msg, $type = 'log')
|
public static function write($msg, $type = 'log')
|
||||||
{
|
{
|
||||||
if (!is_string($msg)) {
|
|
||||||
$msg = var_export($msg, true);
|
|
||||||
}
|
|
||||||
// 封装日志信息
|
// 封装日志信息
|
||||||
$log[$type][] = $msg;
|
$log[$type][] = $msg;
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ class File
|
|||||||
$info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n";
|
$info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n";
|
||||||
foreach ($log as $type => $val) {
|
foreach ($log as $type => $val) {
|
||||||
foreach ($val as $msg) {
|
foreach ($val as $msg) {
|
||||||
|
if (!is_string($msg)) {
|
||||||
|
$msg = var_export($msg, true);
|
||||||
|
}
|
||||||
$info .= '[ ' . $type . ' ] ' . $msg . "\r\n";
|
$info .= '[ ' . $type . ' ] ' . $msg . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ class Sae
|
|||||||
$info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n";
|
$info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n";
|
||||||
foreach ($log as $type => $val) {
|
foreach ($log as $type => $val) {
|
||||||
foreach ($val as $msg) {
|
foreach ($val as $msg) {
|
||||||
|
if (!is_string($msg)) {
|
||||||
|
$msg = var_export($msg, true);
|
||||||
|
}
|
||||||
$info .= '[ ' . $type . ' ] ' . $msg . "\r\n";
|
$info .= '[ ' . $type . ' ] ' . $msg . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ class Socket
|
|||||||
'css' => isset($this->css[$type]) ? $this->css[$type] : '',
|
'css' => isset($this->css[$type]) ? $this->css[$type] : '',
|
||||||
];
|
];
|
||||||
foreach ($val as $msg) {
|
foreach ($val as $msg) {
|
||||||
|
if (!is_string($msg)) {
|
||||||
|
$msg = var_export($msg, true);
|
||||||
|
}
|
||||||
$trace[] = [
|
$trace[] = [
|
||||||
'type' => 'log',
|
'type' => 'log',
|
||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ class Trace
|
|||||||
$debug = [];
|
$debug = [];
|
||||||
foreach ($log as $type => $val) {
|
foreach ($log as $type => $val) {
|
||||||
foreach ($val as $msg) {
|
foreach ($val as $msg) {
|
||||||
|
if (!is_string($msg)) {
|
||||||
|
$msg = var_export($msg, true);
|
||||||
|
}
|
||||||
$debug[$type][] = $msg;
|
$debug[$type][] = $msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user