Add option to hide notices of level STATUS_NOTICE in main MDConsole

This is managed using a public static variable MDConsole::$verbose
This commit is contained in:
Joshua Ramon Enslin 2021-01-21 08:39:42 +01:00
parent 760e69c72a
commit aad9c42786
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -28,6 +28,9 @@ final class MDConsole {
const CONSOLE_LOG_USED_RESOURCES_ENABLED = 1;
const CONSOLE_LOG_USED_RESOURCES_DISABLED = 0;
/** @var boolean */
public static $verbose = true;
/**
* Prints a headline.
*
@ -86,6 +89,8 @@ final class MDConsole {
*/
final public static function write(string $context, int $level = self::STATUS_NOTICE, int $editedNo = 0, string $additionalNote = "", string $link = ""):void {
if (self::$verbose === false and $level === self::STATUS_NOTICE) return;
// Get parts for generating the message to log.
$additionalNote = \strtr($additionalNote, ["ä" => "ae", "ö" => "oe", "ü" => "ue"]);
$date = \date("H:i:s"); // Get current date & time.