Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'prolic/log' into prolic-zen-52
Browse files Browse the repository at this point in the history
Conflicts:
	library/Zend/Log/Logger.php
  • Loading branch information
EvanDotPro committed Jun 28, 2012
11 parents ee7347d + 7af74e7 + 8b311b1 + e2c2b94 + 51601cb + dcc1eaf + 6f4b805 + a30a64f + 8b04bfe + b487f00 + ed718ed commit 38e090d
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 98 deletions.
4 changes: 2 additions & 2 deletions src/Filter/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace Zend\Log\Filter;

use Zend\Log\Exception,
Zend\Validator\ValidatorInterface as ZendValidator;
use Zend\Log\Exception;
use Zend\Validator\ValidatorInterface as ZendValidator;

/**
* @category Zend
Expand Down
8 changes: 4 additions & 4 deletions src/Formatter/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace Zend\Log\Formatter;

use Traversable,
Zend\Stdlib\ArrayUtils,
DOMDocument,
DOMElement;
use Traversable;
use Zend\Stdlib\ArrayUtils;
use DOMDocument;
use DOMElement;

/**
* @category Zend
Expand Down
58 changes: 29 additions & 29 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

namespace Zend\Log;

use DateTime,
Zend\Stdlib\SplPriorityQueue,
Traversable,
Zend\Stdlib\ArrayUtils;
use DateTime;
use Zend\Stdlib\SplPriorityQueue;
use Traversable;
use Zend\Stdlib\ArrayUtils;

/**
* Logging messages with a stack of backends
Expand All @@ -50,7 +50,7 @@ class Logger implements LoggerInterface

/**
* The format of the date used for a log entry (ISO 8601 date)
*
*
* @see http://nl3.php.net/manual/en/function.date.php
* @var string
*/
Expand Down Expand Up @@ -88,18 +88,18 @@ class Logger implements LoggerInterface

/**
* Registered error handler
*
*
* @var boolean
*/
protected static $registeredErrorHandler = false;

/**
* Registered exception handler
*
*
* @var boolean
*/
protected static $registeredExceptionHandler = false;

/**
* Constructor
*
Expand Down Expand Up @@ -215,25 +215,25 @@ public function addWriter($writer, $priority=1)
is_object($writer) ? get_class($writer) : gettype($writer)
));
}

$this->writers->insert($writer, $priority);

return $this;
}

/**
* Get writers
*
* @return SplPriorityQueue
*
* @return SplPriorityQueue
*/
public function getWriters()
{
return $this->writers;
}
/**
* Set the writers
*
* @param SplPriorityQueue $writers
*
* @param SplPriorityQueue $writers
* @throws Exception\InvalidArgumentException
* @return Logger
*/
Expand Down Expand Up @@ -283,14 +283,14 @@ public function log($priority, $message, $extra = array())
if ($this->writers->count() === 0) {
throw new Exception\RuntimeException('No log writer specified');
}

$date = new DateTime();
$timestamp = $date->format($this->getDateTimeFormat());

if (is_array($message)) {
$message = var_export($message, true);
}

foreach ($this->writers->toArray() as $writer) {
$writer->write(array(
'timestamp' => $timestamp,
Expand Down Expand Up @@ -383,11 +383,11 @@ public function debug($message, $extra = array())
{
return $this->log(self::DEBUG, $message, $extra);
}

/**
* Register logging system as an error handler to log PHP errors
*
* @link http://www.php.net/manual/en/function.set-error-handler.php
* @link http://www.php.net/manual/en/function.set-error-handler.php
*
* @param Logger $logger
* @return boolean
Expand All @@ -402,7 +402,7 @@ public static function registerErrorHandler(Logger $logger)
if ($logger === null) {
throw new Exception\InvalidArgumentException('Invalid Logger specified');
}

$errorHandlerMap = array(
E_NOTICE => self::NOTICE,
E_USER_NOTICE => self::NOTICE,
Expand All @@ -417,7 +417,7 @@ public static function registerErrorHandler(Logger $logger)
E_DEPRECATED => self::DEBUG,
E_USER_DEPRECATED => self::DEBUG
);

set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) use ($errorHandlerMap, $logger) {
$errorLevel = error_reporting();

Expand All @@ -435,7 +435,7 @@ public static function registerErrorHandler(Logger $logger)
}
/**
* Unregister error handler
*
*
*/
public static function unregisterErrorHandler()
{
Expand All @@ -444,27 +444,27 @@ public static function unregisterErrorHandler()
}
/**
* Register logging system as an exception handler to log PHP exceptions
*
*
* @link http://www.php.net/manual/en/function.set-exception-handler.php
*
*
* @param Logger $logger
* @return type
* @return type
*/
public static function registerExceptionHandler(Logger $logger)
{
// Only register once per instance
if (self::$registeredExceptionHandler) {
return false;
}

if ($logger === null) {
throw new Exception\InvalidArgumentException('Invalid Logger specified');
}

set_exception_handler(function ($exception) use ($logger){
$extra = array ('file' => $exception->getFile(),
$extra = array ('file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTrace());
'trace' => $exception->getTrace());
if (isset($exception->xdebug_message)) {
$extra['xdebug'] = $exception->xdebug_message;
}
Expand All @@ -473,7 +473,7 @@ public static function registerExceptionHandler(Logger $logger)
self::$registeredExceptionHandler = true;
return true;
}

/**
* Unregister exception handler
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Writer/AbstractWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace Zend\Log\Writer;

use Zend\Log\Filter,
Zend\Log\Formatter\FormatterInterface as Formatter,
Zend\Log\Exception;
use Zend\Log\Filter;
use Zend\Log\Formatter\FormatterInterface as Formatter;
use Zend\Log\Exception;

/**
* @category Zend
Expand Down
6 changes: 3 additions & 3 deletions src/Writer/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace Zend\Log\Writer;

use Zend\Log\Formatter,
Zend\Log\Exception,
Zend\Db\Adapter\Adapter;
use Zend\Log\Formatter;
use Zend\Log\Exception;
use Zend\Db\Adapter\Adapter;

/**
* @category Zend
Expand Down
10 changes: 5 additions & 5 deletions src/Writer/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

namespace Zend\Log\Writer;

use Zend\Log\Formatter\Simple as SimpleFormatter,
Zend\Log\Exception,
Zend\Mail\Message as MailMessage,
Zend\Mail\Transport,
Zend\Mail\Transport\Exception as TransportException;
use Zend\Log\Formatter\Simple as SimpleFormatter;
use Zend\Log\Exception;
use Zend\Mail\Message as MailMessage;
use Zend\Mail\Transport;
use Zend\Mail\Transport\Exception as TransportException;

/**
* Class used for writing log messages to email via Zend\Mail.
Expand Down
4 changes: 2 additions & 2 deletions src/Writer/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace Zend\Log\Writer;

use Zend\Log\Formatter\Simple as SimpleFormatter,
Zend\Log\Exception;
use Zend\Log\Formatter\Simple as SimpleFormatter;
use Zend\Log\Exception;

/**
* @category Zend
Expand Down
6 changes: 3 additions & 3 deletions src/Writer/Syslog.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace Zend\Log\Writer;

use Zend\Log\Logger,
Zend\Log\Formatter,
Zend\Log\Exception;
use Zend\Log\Logger;
use Zend\Log\Formatter;
use Zend\Log\Exception;

/**
* Writes log messages to syslog
Expand Down
4 changes: 2 additions & 2 deletions src/Writer/WriterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Zend\Log\Writer;

use Zend\Log\Formatter\FormatterInterface as Formatter,
Zend\Log\Filter\FilterInterface as Filter;
use Zend\Log\Formatter\FormatterInterface as Formatter;
use Zend\Log\Filter\FilterInterface as Filter;

/**
* @category Zend
Expand Down
4 changes: 2 additions & 2 deletions test/Filter/ChainingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace ZendTest\Log\Filter;

use \Zend\Log\Logger,
\Zend\Log\Writer;
use \Zend\Log\Logger;
use \Zend\Log\Writer;

/**
* @category Zend
Expand Down
4 changes: 2 additions & 2 deletions test/Filter/PriorityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace ZendTest\Log\Filter;

use \Zend\Log\Logger,
\Zend\Log\Filter\Priority;
use \Zend\Log\Logger;
use \Zend\Log\Filter\Priority;

/**
* @category Zend
Expand Down
6 changes: 3 additions & 3 deletions test/Filter/RegexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace ZendTest\Log\Filter;

use Zend\Log\Logger,
Zend\Log\Filter\Regex,
Zend\Config\Config;
use Zend\Log\Logger;
use Zend\Log\Filter\Regex;
use Zend\Config\Config;

/**
* @category Zend
Expand Down
4 changes: 2 additions & 2 deletions test/Filter/SuppressFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace ZendTest\Log\Filter;

use \Zend\Log\Filter\SuppressFilter,
\Zend\Log\Logger;
use \Zend\Log\Filter\SuppressFilter;
use \Zend\Log\Logger;

/**
* @category Zend
Expand Down
10 changes: 5 additions & 5 deletions test/Filter/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

namespace ZendTest\Log\Filter;

use Zend\Log\Logger,
Zend\Log\Filter\Validator,
Zend\Validator\ValidatorChain,
Zend\Validator\Alnum,
Zend\Validator\Int;
use Zend\Log\Logger;
use Zend\Log\Filter\Validator;
use Zend\Validator\ValidatorChain;
use Zend\Validator\Alnum;
use Zend\Validator\Int;

/**
* @category Zend
Expand Down
4 changes: 2 additions & 2 deletions test/Formatter/SimpleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace ZendTest\Log\Formatter;

use ZendTest\Log\TestAsset\StringObject,
\Zend\Log\Formatter\Simple;
use ZendTest\Log\TestAsset\StringObject;
use \Zend\Log\Formatter\Simple;

/**
* @category Zend
Expand Down
4 changes: 2 additions & 2 deletions test/Formatter/XmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace ZendTest\Log\Formatter;

use ZendTest\Log\TestAsset\SerializableObject,
Zend\Log\Formatter\Xml as XmlFormatter;
use ZendTest\Log\TestAsset\SerializableObject;
use Zend\Log\Formatter\Xml as XmlFormatter;

/**
* @category Zend
Expand Down
6 changes: 3 additions & 3 deletions test/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace ZendTest\Log;

use Zend\Log\Logger,
Zend\Log\Writer\Mock as MockWriter,
Zend\Stdlib\SplPriorityQueue;
use Zend\Log\Logger;
use Zend\Log\Writer\Mock as MockWriter;
use Zend\Stdlib\SplPriorityQueue;

/**
* @category Zend
Expand Down
6 changes: 3 additions & 3 deletions test/Writer/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace ZendTest\Log\Writer;

use ZendTest\Log\TestAsset\ConcreteWriter,
Zend\Log\Formatter\Simple as SimpleFormatter,
Zend\Log\Filter\Regex as RegexFilter;
use ZendTest\Log\TestAsset\ConcreteWriter;
use Zend\Log\Formatter\Simple as SimpleFormatter;
use Zend\Log\Filter\Regex as RegexFilter;

/**
* @category Zend
Expand Down
Loading

0 comments on commit 38e090d

Please sign in to comment.