Add static bool to disable output handler completely
This commit is contained in:
parent
0b3fbe803e
commit
f7a92c0c4e
|
@ -13,6 +13,8 @@ final class MDOutputHandler {
|
|||
|
||||
const FLUSH_TO_LOGFILE_AFTER = 100;
|
||||
|
||||
public static bool $disable_completely = false;
|
||||
|
||||
/** @var integer */
|
||||
private int $_verbosity = 0;
|
||||
/** @var string */
|
||||
|
@ -126,6 +128,8 @@ final class MDOutputHandler {
|
|||
*/
|
||||
public function toLog(string $msg, MDConsoleStatus $statusCode = MDConsoleStatus::NOTICE):void {
|
||||
|
||||
if (self::$disable_completely === true) return;
|
||||
|
||||
// Get parts for generating the message to log.
|
||||
++$this->_counter; // Increment counter
|
||||
$date = \date("Y-m-d H:i:s"); // Get current date & time.
|
||||
|
@ -184,6 +188,11 @@ final class MDOutputHandler {
|
|||
*/
|
||||
public function __destruct() {
|
||||
|
||||
if (self::$disable_completely === true) return;
|
||||
|
||||
echo $this->_verbosity;
|
||||
if ($this->_verbosity < 0) return;
|
||||
|
||||
if (!empty($this->_log_queue)) {
|
||||
$this->flush_to_logfile();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user