|
@@ -33,6 +33,18 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
|
|
|
* @param integer $level The minimum logging level which will be written
|
|
* @param integer $level The minimum logging level which will be written
|
|
|
*/
|
|
*/
|
|
|
public function __construct($level = self::ERROR)
|
|
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)) {
|
|
if (!array_key_exists($level, self::$levels)) {
|
|
|
throw new InvalidArgumentException('Unexpected logging level: ' . $level);
|
|
throw new InvalidArgumentException('Unexpected logging level: ' . $level);
|
|
@@ -41,6 +53,16 @@ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
|
|
|
$this->level = $level;
|
|
$this->level = $level;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Get the current minimum logging level.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return integer
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getLevel()
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->level;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record.
|
|
* Adds a log record.
|
|
|
*
|
|
*
|