@@ 310-321 (lines=12) @@ | ||
307 | * 時間単位でローテートする |
|
308 | * stream.log -> stream.(作成日時)-(現在日時).log |
|
309 | */ |
|
310 | private function rotateByCycle() |
|
311 | { |
|
312 | $this->createstatusPath(); |
|
313 | $now = intval(preg_replace('/^.*\s/', '', microtime())); |
|
314 | $createdAt = $this->readStatus($this->logConfig->statusPath); |
|
315 | ||
316 | // ローテート周期を過ぎている場合はログファイルをアーカイブする |
|
317 | $hour = intval(floor(($now - $createdAt) / 3600)); |
|
318 | if ($hour >= $this->logConfig->rotateCycle) { |
|
319 | $this->runRotate($createdAt, $now); |
|
320 | } |
|
321 | } |
|
322 | ||
323 | /** |
|
324 | * サイズ単位でローテートする |
|
@@ 327-338 (lines=12) @@ | ||
324 | * サイズ単位でローテートする |
|
325 | * stream.log -> stream.(作成日時)-(現在日時).log |
|
326 | */ |
|
327 | private function rotateBySize() |
|
328 | { |
|
329 | $this->createstatusPath(); |
|
330 | $now = intval(preg_replace('/^.*\s/', '', microtime())); |
|
331 | $createdAt = $this->readStatus(); |
|
332 | ||
333 | $size_kb = (int) floor(filesize($this->logConfig->logPath) / 1024); |
|
334 | // 指定したサイズより大きければローテート |
|
335 | if ($size_kb >= $this->logConfig->rotateSize) { |
|
336 | $this->runRotate($createdAt, $now); |
|
337 | } |
|
338 | } |
|
339 | ||
340 | /** |
|
341 | * ログ出力パスを返却する |