@@ 289-300 (lines=12) @@ | ||
286 | * 時間単位でローテートする |
|
287 | * stream.log -> stream.(作成日時)-(現在日時).log |
|
288 | */ |
|
289 | private function rotateByCycle() |
|
290 | { |
|
291 | $this->createstatusPath(); |
|
292 | $now = intval(preg_replace('/^.*\s/', '', microtime())); |
|
293 | $createdAt = $this->readStatus($this->logConfig->statusPath); |
|
294 | ||
295 | // ローテート周期を過ぎている場合はログファイルをアーカイブする |
|
296 | $hour = intval(floor(($now - $createdAt) / 3600)); |
|
297 | if ($hour >= $this->logConfig->rotateCycle) { |
|
298 | $this->runRotate($createdAt, $now); |
|
299 | } |
|
300 | } |
|
301 | ||
302 | /** |
|
303 | * サイズ単位でローテートする |
|
@@ 306-317 (lines=12) @@ | ||
303 | * サイズ単位でローテートする |
|
304 | * stream.log -> stream.(作成日時)-(現在日時).log |
|
305 | */ |
|
306 | private function rotateBySize() |
|
307 | { |
|
308 | $this->createstatusPath(); |
|
309 | $now = intval(preg_replace('/^.*\s/', '', microtime())); |
|
310 | $createdAt = $this->readStatus(); |
|
311 | ||
312 | $size_kb = (int) floor(filesize($this->logConfig->logPath) / 1024); |
|
313 | // 指定したサイズより大きければローテート |
|
314 | if ($size_kb >= $this->logConfig->rotateSize) { |
|
315 | $this->runRotate($createdAt, $now); |
|
316 | } |
|
317 | } |
|
318 | ||
319 | /** |
|
320 | * ログ出力パスを返却する |