改进日志存储结构和输出驱动

This commit is contained in:
thinkphp
2016-06-06 14:22:37 +08:00
parent 486e58975b
commit 0efb5d02fd
5 changed files with 62 additions and 48 deletions

View File

@@ -41,14 +41,11 @@ class Sae
$memory_str = " [内存消耗:{$memory_use}kb]";
$file_load = " [文件加载:" . count(get_included_files()) . "]";
array_unshift($log, [
'type' => 'log',
'msg' => $current_uri . $time_str . $memory_str . $file_load,
]);
$info = '';
foreach ($log as $line) {
$info .= '[' . $line['type'] . '] ' . $line['msg'] . "\r\n";
$info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n";
foreach ($log as $type => $val) {
foreach ($val as $msg) {
$info .= '[ ' . $type . ' ] ' . $msg . "\r\n";
}
}
$logstr = "[{$now}] {$_SERVER['SERVER_ADDR']} {$_SERVER['REMOTE_ADDR']} {$_SERVER['REQUEST_URI']}\r\n{$info}\r\n";