Remove superfluous file stats when setting file logging to true
This commit is contained in:
parent
c7cc6c5810
commit
aaa5a0dad3
|
@ -30,6 +30,8 @@ final class MDOutputHandler {
|
||||||
|
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
private array $_log_queue = [];
|
private array $_log_queue = [];
|
||||||
|
/** @var boolean */
|
||||||
|
private bool $_logfile_status_checked = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes log file contents to log file.
|
* Writes log file contents to log file.
|
||||||
|
@ -38,7 +40,21 @@ final class MDOutputHandler {
|
||||||
*/
|
*/
|
||||||
public function flush_to_logfile():void {
|
public function flush_to_logfile():void {
|
||||||
|
|
||||||
|
echo "Will flush to log file" . PHP_EOL . PHP_EOL . PHP_EOL;
|
||||||
|
|
||||||
|
if ($this->_logfile_status_checked === false) {
|
||||||
|
|
||||||
|
if (!\is_dir(__DIR__ . "/../logs")) {
|
||||||
|
\mkdir(__DIR__ . "/../logs", 0775);
|
||||||
|
}
|
||||||
|
|
||||||
|
\touch($this->_logfile);
|
||||||
|
$this->_logfile_status_checked = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
\file_put_contents($this->_logfile, implode(PHP_EOL, $this->_log_queue), FILE_APPEND);
|
\file_put_contents($this->_logfile, implode(PHP_EOL, $this->_log_queue), FILE_APPEND);
|
||||||
|
|
||||||
$this->_log_queue = [];
|
$this->_log_queue = [];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,11 +113,6 @@ final class MDOutputHandler {
|
||||||
|
|
||||||
$this->_file_logging = $input;
|
$this->_file_logging = $input;
|
||||||
|
|
||||||
if ($this->_file_logging === true) {
|
|
||||||
if (!\is_dir(__DIR__ . "/../logs")) mkdir(__DIR__ . "/../logs", 0775);
|
|
||||||
\touch($this->_logfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user