@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (empty($this->config['path'])) { |
| 43 | - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; |
|
| 43 | + $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR; |
|
| 44 | 44 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
| 45 | 45 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
| 46 | 46 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $msg = var_export($msg, true); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg; |
|
| 72 | + $info[$type][] = $this->config['json'] ? $msg : '[ '.$type.' ] '.$msg; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | protected function getMasterLogFile() |
| 137 | 137 | { |
| 138 | 138 | if ($this->config['max_files']) { |
| 139 | - $files = glob($this->config['path'] . '*.log'); |
|
| 139 | + $files = glob($this->config['path'].'*.log'); |
|
| 140 | 140 | |
| 141 | 141 | try { |
| 142 | 142 | if (count($files) > $this->config['max_files']) { |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | if ($this->config['single']) { |
| 152 | 152 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
| 153 | 153 | |
| 154 | - $destination = $this->config['path'] . $name . $cli . '.log'; |
|
| 154 | + $destination = $this->config['path'].$name.$cli.'.log'; |
|
| 155 | 155 | } else { |
| 156 | 156 | if ($this->config['max_files']) { |
| 157 | - $filename = date('Ymd') . $cli . '.log'; |
|
| 157 | + $filename = date('Ymd').$cli.'.log'; |
|
| 158 | 158 | } else { |
| 159 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; |
|
| 159 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $destination = $this->config['path'] . $filename; |
|
| 162 | + $destination = $this->config['path'].$filename; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $destination; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $name = date('d'); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log'; |
|
| 187 | + return $path.DIRECTORY_SEPARATOR.$name.'_'.$type.$cli.'.log'; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
| 199 | 199 | try { |
| 200 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
| 200 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
| 201 | 201 | } catch (\Exception $e) { |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | protected function parseCliLog($info) |
| 213 | 213 | { |
| 214 | 214 | if ($this->config['json']) { |
| 215 | - $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
| 215 | + $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
| 216 | 216 | } else { |
| 217 | 217 | $now = $info['timestamp']; |
| 218 | 218 | unset($info['timestamp']); |
| 219 | 219 | |
| 220 | 220 | $message = implode(PHP_EOL, $info); |
| 221 | 221 | |
| 222 | - $message = "[{$now}]" . $message . PHP_EOL; |
|
| 222 | + $message = "[{$now}]".$message.PHP_EOL; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | return $message; |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | if ($this->config['json']) { |
| 244 | 244 | $info = $requestInfo + $info; |
| 245 | - return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
| 245 | + return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - array_unshift($info, "---------------------------------------------------------------" . PHP_EOL . "\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
| 248 | + array_unshift($info, "---------------------------------------------------------------".PHP_EOL."\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
| 249 | 249 | unset($info['timestamp']); |
| 250 | 250 | |
| 251 | - return implode(PHP_EOL, $info) . PHP_EOL; |
|
| 251 | + return implode(PHP_EOL, $info).PHP_EOL; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | protected function getDebugLog(&$info, $append, $apart) |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
| 264 | 264 | |
| 265 | 265 | $info = [ |
| 266 | - 'runtime' => number_format($runtime, 6) . 's', |
|
| 267 | - 'reqs' => $reqs . 'req/s', |
|
| 268 | - 'memory' => $memory_use . 'kb', |
|
| 266 | + 'runtime' => number_format($runtime, 6).'s', |
|
| 267 | + 'reqs' => $reqs.'req/s', |
|
| 268 | + 'memory' => $memory_use.'kb', |
|
| 269 | 269 | 'file' => count(get_included_files()), |
| 270 | 270 | ] + $info; |
| 271 | 271 | |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
| 278 | 278 | |
| 279 | - $time_str = '[运行时间:' . number_format($runtime, 6) . 's] [吞吐率:' . $reqs . 'req/s]'; |
|
| 280 | - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; |
|
| 281 | - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; |
|
| 279 | + $time_str = '[运行时间:'.number_format($runtime, 6).'s] [吞吐率:'.$reqs.'req/s]'; |
|
| 280 | + $memory_str = ' [内存消耗:'.$memory_use.'kb]'; |
|
| 281 | + $file_load = ' [文件加载:'.count(get_included_files()).']'; |
|
| 282 | 282 | |
| 283 | - array_unshift($info, $time_str . $memory_str . $file_load); |
|
| 283 | + array_unshift($info, $time_str.$memory_str.$file_load); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |