From 89643ff9afc2cd102ebc365226d097a67b91d6f8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 10 Jun 2018 10:49:12 +0100 Subject: [PATCH] MainLogger: Added getFormat() and setFormat() this allows plugins to easily alter the output of the console logger. --- src/pocketmine/utils/MainLogger.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/pocketmine/utils/MainLogger.php b/src/pocketmine/utils/MainLogger.php index d69f733f66..7d6182d0ab 100644 --- a/src/pocketmine/utils/MainLogger.php +++ b/src/pocketmine/utils/MainLogger.php @@ -97,6 +97,32 @@ class MainLogger extends \AttachableThreadedLogger{ } } + /** + * Returns the current logger format used for console output. + * + * @return string + */ + public function getFormat() : string{ + return $this->format; + } + + /** + * Sets the logger format to use for outputting text to the console. + * It should be an sprintf()able string accepting 5 string arguments: + * - time + * - color + * - thread name + * - prefix (debug, info etc) + * - message + * + * @see http://php.net/manual/en/function.sprintf.php + * + * @param string $format + */ + public function setFormat(string $format) : void{ + $this->format = $format; + } + public function emergency($message){ $this->send($message, \LogLevel::EMERGENCY, "EMERGENCY", TextFormat::RED); }