mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-18 12:48:41 +00:00
Bug fix if no file logging is required
This commit is contained in:
parent
4640872d7e
commit
34ffc44353
|
|
@ -82,6 +82,8 @@ class FileLogger implements LoggerInterface
|
|||
*/
|
||||
private $path = '';
|
||||
|
||||
private $created = false;
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*
|
||||
|
|
@ -103,14 +105,22 @@ class FileLogger implements LoggerInterface
|
|||
}
|
||||
|
||||
if (is_dir($lpath) || strpos($lpath, '.') === false) {
|
||||
File::create($path = $path . '/' . date('Y-m-d') . '.log');
|
||||
$path = $path . '/' . date('Y-m-d') . '.log';
|
||||
} else {
|
||||
File::create($path = $lpath);
|
||||
$path = $lpath;
|
||||
}
|
||||
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
private function createFile()
|
||||
{
|
||||
if (!file_exists($this->path) && !$this->created) {
|
||||
File::create($this->path);
|
||||
$this->created = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns instance.
|
||||
*
|
||||
|
|
@ -284,6 +294,7 @@ class FileLogger implements LoggerInterface
|
|||
*/
|
||||
private function write(string $message)
|
||||
{
|
||||
$this->createFile();
|
||||
$this->fp = fopen($this->path, 'a');
|
||||
|
||||
if ($this->fp !== false) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user