1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 00:56:08 +02:00

Merge remote-tracking branch 'FGM/master'

This commit is contained in:
Jordi Boggiano
2012-06-19 20:28:04 +02:00
6 changed files with 108 additions and 38 deletions

View File

@@ -36,6 +36,11 @@ class Logger
*/
const INFO = 200;
/**
* Uncommon events
*/
const NOTICE = 250;
/**
* Exceptional occurrences that are not errors
*
@@ -64,13 +69,20 @@ class Logger
*/
const ALERT = 550;
/**
* Urgent alert.
*/
const EMERGENCY = 600;
protected static $levels = array(
100 => 'DEBUG',
200 => 'INFO',
250 => 'NOTICE',
300 => 'WARNING',
400 => 'ERROR',
500 => 'CRITICAL',
550 => 'ALERT',
600 => 'EMERGENCY',
);
protected $name;
@@ -221,6 +233,18 @@ class Logger
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.
*
@@ -269,6 +293,19 @@ class Logger
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.
*
@@ -312,7 +349,7 @@ class Logger
/**
* 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 array $context The log context
@@ -326,7 +363,7 @@ class Logger
/**
* 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 array $context The log context
@@ -340,7 +377,7 @@ class Logger
/**
* 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 array $context The log context
@@ -348,13 +385,13 @@ class Logger
*/
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.
*
* 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 array $context The log context
@@ -368,7 +405,7 @@ class Logger
/**
* 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 array $context The log context
@@ -382,7 +419,7 @@ class Logger
/**
* 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 array $context The log context
@@ -396,7 +433,7 @@ class Logger
/**
* 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 array $context The log context
@@ -408,9 +445,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 array $context The log context
@@ -418,6 +455,6 @@ class Logger
*/
public function emerg($message, array $context = array())
{
return $this->addRecord(self::ALERT, $message, $context);
return $this->addRecord(self::EMERGENCY, $message, $context);
}
}