mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 14:08:40 +00:00
Turning verbose into a member variable
This commit is contained in:
parent
c82b15c332
commit
73cee286a1
|
|
@ -63,7 +63,7 @@ class FileLogger implements LoggerInterface
|
||||||
* @var bool
|
* @var bool
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static $verbose = false;
|
protected $verbose = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The file pointer for the logging.
|
* The file pointer for the logging.
|
||||||
|
|
@ -97,7 +97,7 @@ class FileLogger implements LoggerInterface
|
||||||
public function __construct(string $lpath, bool $verbose = false)
|
public function __construct(string $lpath, bool $verbose = false)
|
||||||
{
|
{
|
||||||
$path = realpath($lpath);
|
$path = realpath($lpath);
|
||||||
self::$verbose = $verbose;
|
$this->verbose = $verbose;
|
||||||
|
|
||||||
if ($path !== false && Validator::startsWith($path, ROOT_PATH) === false) {
|
if ($path !== false && Validator::startsWith($path, ROOT_PATH) === false) {
|
||||||
throw new PathException($lpath);
|
throw new PathException($lpath);
|
||||||
|
|
@ -120,17 +120,18 @@ class FileLogger implements LoggerInterface
|
||||||
/**
|
/**
|
||||||
* Returns instance.
|
* Returns instance.
|
||||||
*
|
*
|
||||||
* @param string $path Logging path
|
* @param string $path Logging path
|
||||||
|
* @param bool $verbose Verbose logging
|
||||||
*
|
*
|
||||||
* @return FileLogger
|
* @return FileLogger
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
*/
|
*/
|
||||||
public static function getInstance(string $path = '') : FileLogger
|
public static function getInstance(string $path = '', bool $verbose = true) : FileLogger
|
||||||
{
|
{
|
||||||
if (self::$instance === null) {
|
if (self::$instance === null) {
|
||||||
self::$instance = new self($path);
|
self::$instance = new self($path, $verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
|
|
@ -297,7 +298,7 @@ class FileLogger implements LoggerInterface
|
||||||
$this->fp = false;
|
$this->fp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::$verbose) {
|
if ($this->verbose) {
|
||||||
echo $message, "\n";
|
echo $message, "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user