1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00
This commit is contained in:
Jordi Boggiano
2013-07-29 00:08:51 +02:00
parent e2e041eded
commit 4277c5db4a
7 changed files with 35 additions and 30 deletions

View File

@@ -47,10 +47,10 @@ class ErrorHandler
* *
* By default it will handle errors, exceptions and fatal errors * By default it will handle errors, exceptions and fatal errors
* *
* @param LoggerInterface $logger * @param LoggerInterface $logger
* @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling
* @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling * @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling
* @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling * @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling
* @return ErrorHandler * @return ErrorHandler
*/ */
public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null) public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)

View File

@@ -23,9 +23,9 @@ class ErrorLogHandler extends AbstractProcessingHandler
protected $messageType; protected $messageType;
/** /**
* @param integer $messageType Says where the error should go. * @param integer $messageType Says where the error should go.
* @param integer $level The minimum logging level at which this handler will be triggered * @param integer $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
*/ */
public function __construct($messageType = 0, $level = Logger::DEBUG, $bubble = true) public function __construct($messageType = 0, $level = Logger::DEBUG, $bubble = true)
{ {

View File

@@ -37,7 +37,7 @@ class ChannelLevelActivationStrategy implements ActivationStrategyInterface
private $channelToActionLevel; private $channelToActionLevel;
/** /**
* @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any
* @param array $categoryToActionLevel An array that maps channel names to action levels. * @param array $categoryToActionLevel An array that maps channel names to action levels.
*/ */
public function __construct($defaultActionLevel, $channelToActionLevel = array()) public function __construct($defaultActionLevel, $channelToActionLevel = array())

View File

@@ -48,13 +48,13 @@ class HipChatHandler extends SocketHandler
private $notify; private $notify;
/** /**
* @param string $token HipChat API Token * @param string $token HipChat API Token
* @param string $room The room that should be alerted of the message (Id or Name) * @param string $room The room that should be alerted of the message (Id or Name)
* @param string $name Name used in the "from" field * @param string $name Name used in the "from" field
* @param bool $notify Trigger a notification in clients or not * @param bool $notify Trigger a notification in clients or not
* @param int $level The minimum logging level at which this handler will be triggered * @param int $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param Boolean $useSSL Whether to connect via SSL. * @param Boolean $useSSL Whether to connect via SSL.
*/ */
public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true) public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true)
{ {
@@ -70,7 +70,7 @@ class HipChatHandler extends SocketHandler
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @param array $record * @param array $record
* @return string * @return string
*/ */
protected function generateDataStream($record) protected function generateDataStream($record)
@@ -83,7 +83,7 @@ class HipChatHandler extends SocketHandler
/** /**
* Builds the body of API call * Builds the body of API call
* *
* @param array $record * @param array $record
* @return string * @return string
*/ */
private function buildContent($record) private function buildContent($record)
@@ -103,7 +103,7 @@ class HipChatHandler extends SocketHandler
/** /**
* Builds the header of the API Call * Builds the header of the API Call
* *
* @param string $content * @param string $content
* @return string * @return string
*/ */
private function buildHeader($content) private function buildHeader($content)
@@ -120,7 +120,7 @@ class HipChatHandler extends SocketHandler
/** /**
* Assigns a color to each level of log records. * Assigns a color to each level of log records.
* *
* @param integer $level * @param integer $level
* @return string * @return string
*/ */
protected function getAlertColor($level) protected function getAlertColor($level)

View File

@@ -30,12 +30,12 @@ class PushoverHandler extends SocketHandler
private $emergencyLevel; private $emergencyLevel;
/** /**
* @param string $token Pushover api token * @param string $token Pushover api token
* @param string|array $users Pushover user id or array of ids the message will be sent to * @param string|array $users Pushover user id or array of ids the message will be sent to
* @param string $title Title sent to the Pushover API * @param string $title Title sent to the Pushover API
* @param integer $level The minimum logging level at which this handler will be triggered * @param integer $level The minimum logging level at which this handler will be triggered
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
* @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not * @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not
* the pushover.net app owner. OpenSSL is required for this option. * the pushover.net app owner. OpenSSL is required for this option.
* @param integer $highPriorityLevel The minimum logging level at which this handler will start * @param integer $highPriorityLevel The minimum logging level at which this handler will start
* sending "high priority" requests to the Pushover API * sending "high priority" requests to the Pushover API
@@ -108,11 +108,13 @@ class PushoverHandler extends SocketHandler
$this->user = null; $this->user = null;
} }
public function setHighPriorityLevel($value) { public function setHighPriorityLevel($value)
{
$this->highPriorityLevel = $value; $this->highPriorityLevel = $value;
} }
public function setEmergencyLevel($value) { public function setEmergencyLevel($value)
{
$this->emergencyLevel = $value; $this->emergencyLevel = $value;
} }
} }

View File

@@ -69,7 +69,7 @@ class RavenHandler extends AbstractProcessingHandler
$level = $this->level; $level = $this->level;
// filter records based on their level // filter records based on their level
$records = array_filter($records, function($record) use($level) { $records = array_filter($records, function($record) use ($level) {
return $record['level'] >= $level; return $record['level'] >= $level;
}); });
@@ -79,7 +79,7 @@ class RavenHandler extends AbstractProcessingHandler
// the record with the highest severity is the "main" one // the record with the highest severity is the "main" one
$record = array_reduce($records, function($highest, $record) { $record = array_reduce($records, function($highest, $record) {
if($record['level'] >= $highest['level']) { if ($record['level'] >= $highest['level']) {
$highest = $record; $highest = $record;
return $highest; return $highest;
@@ -140,6 +140,7 @@ class RavenHandler extends AbstractProcessingHandler
if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) { if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
$options['extra']['message'] = $record['formatted']; $options['extra']['message'] = $record['formatted'];
$this->ravenClient->captureException($record['context']['exception'], $options); $this->ravenClient->captureException($record['context']['exception'], $options);
return; return;
} }

View File

@@ -54,10 +54,12 @@ class StubNewRelicHandler extends NewRelicHandler
} }
} }
function newrelic_notice_error() { function newrelic_notice_error()
{
return true; return true;
} }
function newrelic_add_custom_parameter() { function newrelic_add_custom_parameter()
{
return true; return true;
} }