79 parent::__construct($filename,
$mode, $delay);
87 fclose($this->stream);
88 if ($this->backupCount > 0) {
89 for ($i = $this->backupCount - 1; $i > 0; $i--) {
90 $sfn = sprintf(
"%s.%d", $this->baseFilename, $i);
91 $dfn = sprintf(
"%s.%d", $this->baseFilename, $i + 1);
92 if (file_exists($sfn)) {
93 if (file_exists($dfn)) {
99 $dfn = sprintf(
"%s.1", $this->baseFilename);
100 if (file_exists($dfn)) {
103 rename($this->baseFilename, $dfn);
106 $this->stream = $this->
open();
112 if (!$this->stream) {
113 $this->stream = $this->
open();
116 if ($this->maxBytes > 0) {
117 $msg = $this->
format($record).
"\n";
120 fseek($this->stream, 0, SEEK_END);
121 $newPos = ftell($this->stream) + strlen($msg);
122 if ($newPos >= $this->maxBytes || $newPos < 0) {
shouldRollover(\Plop\RecordInterface $record)
An handler the saves log messages in a file, which is rotated whenever it reaches a certain size...
$mode
Opening mode for the log file.
Interface for a log record.
__construct($filename, $maxBytes=0, $backupCount=0, $mode= 'a', $delay=0)
format(\Plop\RecordInterface $record)
$maxBytes
The maximum size the log file may reach before being rotated.
An abstract class for handlers that must deal with file rotations.
$backupCount
Number of backup log files to keep.