mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-10 20:08:01 +00:00
MainLogger: remove obsolete logFile field
This commit is contained in:
parent
7684dc03fa
commit
6d64fb9af8
@ -30,15 +30,11 @@ use pocketmine\thread\Worker;
|
|||||||
use function get_class;
|
use function get_class;
|
||||||
use function preg_replace;
|
use function preg_replace;
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
use function touch;
|
|
||||||
use function trim;
|
use function trim;
|
||||||
use const PHP_EOL;
|
use const PHP_EOL;
|
||||||
use const PTHREADS_INHERIT_NONE;
|
use const PTHREADS_INHERIT_NONE;
|
||||||
|
|
||||||
class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
|
class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
protected $logFile;
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $logDebug;
|
protected $logDebug;
|
||||||
|
|
||||||
@ -59,15 +55,13 @@ class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $logFile, bool $logDebug = false){
|
public function __construct(string $logFile, bool $logDebug = false){
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
touch($logFile);
|
|
||||||
$this->logFile = $logFile;
|
|
||||||
$this->logDebug = $logDebug;
|
$this->logDebug = $logDebug;
|
||||||
|
|
||||||
//Child threads may not inherit command line arguments, so if there's an override it needs to be recorded here
|
//Child threads may not inherit command line arguments, so if there's an override it needs to be recorded here
|
||||||
$this->mainThreadHasFormattingCodes = Terminal::hasFormattingCodes();
|
$this->mainThreadHasFormattingCodes = Terminal::hasFormattingCodes();
|
||||||
$this->timezone = Timezone::get();
|
$this->timezone = Timezone::get();
|
||||||
|
|
||||||
$this->logWriterThread = new MainLoggerThread($this->logFile);
|
$this->logWriterThread = new MainLoggerThread($logFile);
|
||||||
$this->logWriterThread->start(PTHREADS_INHERIT_NONE);
|
$this->logWriterThread->start(PTHREADS_INHERIT_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ use function fclose;
|
|||||||
use function fopen;
|
use function fopen;
|
||||||
use function fwrite;
|
use function fwrite;
|
||||||
use function is_resource;
|
use function is_resource;
|
||||||
|
use function touch;
|
||||||
|
|
||||||
final class MainLoggerThread extends \Thread{
|
final class MainLoggerThread extends \Thread{
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ final class MainLoggerThread extends \Thread{
|
|||||||
|
|
||||||
public function __construct(string $logFile){
|
public function __construct(string $logFile){
|
||||||
$this->buffer = new \Threaded();
|
$this->buffer = new \Threaded();
|
||||||
|
touch($logFile);
|
||||||
$this->logFile = $logFile;
|
$this->logFile = $logFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user