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. *