mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Removed minor code duplication in MainLogger
This commit is contained in:
parent
d5f6966ce3
commit
475066c9f5
@ -221,6 +221,13 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function writeLogStream(){
|
||||||
|
while($this->logStream->count() > 0){
|
||||||
|
$chunk = $this->logStream->shift();
|
||||||
|
fwrite($this->logResource, $chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
$this->shutdown = false;
|
$this->shutdown = false;
|
||||||
$this->logResource = fopen($this->logFile, "a+b");
|
$this->logResource = fopen($this->logFile, "a+b");
|
||||||
@ -230,21 +237,12 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
|
|
||||||
while($this->shutdown === false){
|
while($this->shutdown === false){
|
||||||
$this->synchronized(function(){
|
$this->synchronized(function(){
|
||||||
while($this->logStream->count() > 0){
|
$this->writeLogStream();
|
||||||
$chunk = $this->logStream->shift();
|
|
||||||
fwrite($this->logResource, $chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->wait(25000);
|
$this->wait(25000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->logStream->count() > 0){
|
$this->writeLogStream();
|
||||||
while($this->logStream->count() > 0){
|
|
||||||
$chunk = $this->logStream->shift();
|
|
||||||
fwrite($this->logResource, $chunk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose($this->logResource);
|
fclose($this->logResource);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user