From 782017e4619f12516bf230a45b6f54686ea285ea Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Fri, 28 Sep 2012 11:03:52 -0400 Subject: [PATCH] Add get/setLevel to AbstractLogger. --- src/Mustache/Logger/AbstractLogger.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Mustache/Logger/AbstractLogger.php b/src/Mustache/Logger/AbstractLogger.php index d22f166..498cdce 100644 --- a/src/Mustache/Logger/AbstractLogger.php +++ b/src/Mustache/Logger/AbstractLogger.php @@ -33,6 +33,18 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger * @param integer $level The minimum logging level which will be written */ public function __construct($level = self::ERROR) + { + $this->setLevel($level); + } + + /** + * Set the minimum logging level. + * + * @throws InvalidArgumentException if the logging level is unknown. + * + * @param integer $level The minimum logging level which will be written + */ + public function setLevel($level) { if (!array_key_exists($level, self::$levels)) { throw new InvalidArgumentException('Unexpected logging level: ' . $level); @@ -41,6 +53,16 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger $this->level = $level; } + /** + * Get the current minimum logging level. + * + * @return integer + */ + public function getLevel() + { + return $this->level; + } + /** * Adds a log record. *