|
@@ -36,6 +36,11 @@ class Logger
|
|
|
*/
|
|
*/
|
|
|
const INFO = 200;
|
|
const INFO = 200;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Uncommon events
|
|
|
|
|
+ */
|
|
|
|
|
+ const NOTICE = 250;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Exceptional occurrences that are not errors
|
|
* Exceptional occurrences that are not errors
|
|
|
*
|
|
*
|
|
@@ -64,13 +69,20 @@ class Logger
|
|
|
*/
|
|
*/
|
|
|
const ALERT = 550;
|
|
const ALERT = 550;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Urgent alert.
|
|
|
|
|
+ */
|
|
|
|
|
+ const EMERGENCY = 600;
|
|
|
|
|
+
|
|
|
protected static $levels = array(
|
|
protected static $levels = array(
|
|
|
100 => 'DEBUG',
|
|
100 => 'DEBUG',
|
|
|
200 => 'INFO',
|
|
200 => 'INFO',
|
|
|
|
|
+ 250 => 'NOTICE',
|
|
|
300 => 'WARNING',
|
|
300 => 'WARNING',
|
|
|
400 => 'ERROR',
|
|
400 => 'ERROR',
|
|
|
500 => 'CRITICAL',
|
|
500 => 'CRITICAL',
|
|
|
550 => 'ALERT',
|
|
550 => 'ALERT',
|
|
|
|
|
+ 600 => 'EMERGENCY',
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
protected $name;
|
|
protected $name;
|
|
@@ -219,6 +231,18 @@ class Logger
|
|
|
return $this->addRecord(self::INFO, $message, $context);
|
|
return $this->addRecord(self::INFO, $message, $context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Adds a log record at the NOTICE level.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $message The log message
|
|
|
|
|
+ * @param array $context The log context
|
|
|
|
|
+ * @return Boolean Whether the record has been processed
|
|
|
|
|
+ */
|
|
|
|
|
+ public function addNotice($message, array $context = array())
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->addRecord(self::NOTICE, $message, $context);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the WARNING level.
|
|
* Adds a log record at the WARNING level.
|
|
|
*
|
|
*
|
|
@@ -267,6 +291,19 @@ class Logger
|
|
|
return $this->addRecord(self::ALERT, $message, $context);
|
|
return $this->addRecord(self::ALERT, $message, $context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Adds a log record at the EMERGENCY level.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $message The log message
|
|
|
|
|
+ * @param array $context The log context
|
|
|
|
|
+ * @return Boolean Whether the record has been processed
|
|
|
|
|
+ */
|
|
|
|
|
+ public function addEmergency($message, array $context = array())
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->addRecord(self::EMERGENCY, $message, $context);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Gets the name of the logging level.
|
|
* Gets the name of the logging level.
|
|
|
*
|
|
*
|
|
@@ -310,7 +347,7 @@ class Logger
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the DEBUG level.
|
|
* Adds a log record at the DEBUG level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -324,7 +361,7 @@ class Logger
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the INFO level.
|
|
* Adds a log record at the INFO level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -338,7 +375,7 @@ class Logger
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the INFO level.
|
|
* Adds a log record at the INFO level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -346,13 +383,13 @@ class Logger
|
|
|
*/
|
|
*/
|
|
|
public function notice($message, array $context = array())
|
|
public function notice($message, array $context = array())
|
|
|
{
|
|
{
|
|
|
- return $this->addRecord(self::INFO, $message, $context);
|
|
|
|
|
|
|
+ return $this->addRecord(self::NOTICE, $message, $context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the WARNING level.
|
|
* Adds a log record at the WARNING level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -366,7 +403,7 @@ class Logger
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the ERROR level.
|
|
* Adds a log record at the ERROR level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -380,7 +417,7 @@ class Logger
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the CRITICAL level.
|
|
* Adds a log record at the CRITICAL level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -394,7 +431,7 @@ class Logger
|
|
|
/**
|
|
/**
|
|
|
* Adds a log record at the ALERT level.
|
|
* Adds a log record at the ALERT level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -406,9 +443,9 @@ class Logger
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Adds a log record at the ALERT level.
|
|
|
|
|
|
|
+ * Adds a log record at the EMERGENCY level.
|
|
|
*
|
|
*
|
|
|
- * This method allows to have an easy ZF compatibility.
|
|
|
|
|
|
|
+ * This method allows to have an easy ZF/Symfony 2 compatibility.
|
|
|
*
|
|
*
|
|
|
* @param string $message The log message
|
|
* @param string $message The log message
|
|
|
* @param array $context The log context
|
|
* @param array $context The log context
|
|
@@ -416,6 +453,6 @@ class Logger
|
|
|
*/
|
|
*/
|
|
|
public function emerg($message, array $context = array())
|
|
public function emerg($message, array $context = array())
|
|
|
{
|
|
{
|
|
|
- return $this->addRecord(self::ALERT, $message, $context);
|
|
|
|
|
|
|
+ return $this->addRecord(self::EMERGENCY, $message, $context);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|