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-renamed-interfaces'
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 20 changed files with 330 additions and 42 deletions.
30 changes: 30 additions & 0 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Log\Exception;

/**
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\Log\Exception
implements ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
*/
class RuntimeException
extends \RuntimeException
implements \Zend\Log\Exception
implements ExceptionInterface
{}
38 changes: 38 additions & 0 deletions src/Filter/FilterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Log\Filter;

/**
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface FilterInterface
{
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function filter(array $event);
}
5 changes: 2 additions & 3 deletions src/Filter/Priority.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace Zend\Log\Filter;

use Zend\Log\Exception,
Zend\Log\Filter;
use Zend\Log\Exception;

/**
* @category Zend
Expand All @@ -31,7 +30,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Priority implements Filter
class Priority implements FilterInterface
{
/**
* @var int
Expand Down
6 changes: 2 additions & 4 deletions src/Filter/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
*/
namespace Zend\Log\Filter;

use Zend\Log\Exception,
Zend\Log\Filter;
use Zend\Log\Exception;

/**
* @category Zend
Expand All @@ -34,7 +33,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Regex implements Filter
class Regex implements FilterInterface
{
/**
* Regex to match
Expand All @@ -47,7 +46,6 @@ class Regex implements Filter
* Filter out any log messages not matching the pattern
*
* @param string $regex Regular expression to test the log message
* @return Message
* @throws Exception\InvalidArgumentException
*/
public function __construct($regex)
Expand Down
5 changes: 2 additions & 3 deletions src/Filter/SuppressFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace Zend\Log\Filter;

use Zend\Log\Exception,
Zend\Log\Filter;
use Zend\Log\Exception;

/**
* @category Zend
Expand All @@ -31,7 +30,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class SuppressFilter implements Filter
class SuppressFilter implements FilterInterface
{
/**
* @var boolean
Expand Down
3 changes: 1 addition & 2 deletions src/Filter/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
namespace Zend\Log\Filter;

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

/**
Expand All @@ -32,7 +31,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Validator implements Filter
class Validator implements FilterInterface
{
/**
* Regex to match
Expand Down
7 changes: 3 additions & 4 deletions src/Formatter/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* @namespace
*/
namespace Zend\Log\Formatter;
use Zend\Log\Formatter,
Zend\Log\Exception;

use Zend\Log\Exception;

/**
* @category Zend
Expand All @@ -33,7 +33,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ErrorHandler implements Formatter
class ErrorHandler implements FormatterInterface
{
const DEFAULT_FORMAT = '%timestamp% %priorityName% (%priority%) %message% (errno %extra[errno]%) in %extra[file]% on line %extra[line]%';

Expand All @@ -48,7 +48,6 @@ class ErrorHandler implements Formatter
* Class constructor
*
* @param null|string $format Format specifier for log messages
* @return void
* @throws Zend\Log\Exception\InvalidArgumentException
*/
public function __construct($format = null)
Expand Down
4 changes: 1 addition & 3 deletions src/Formatter/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@
*/
namespace Zend\Log\Formatter;

use Zend\Log\Formatter;

/**
* @category Zend
* @package Zend_Log
* @subpackage Formatter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ExceptionHandler implements Formatter
class ExceptionHandler implements FormatterInterface
{
/**
* This method formats the event for the PHP Exception
Expand Down
38 changes: 38 additions & 0 deletions src/Formatter/FormatterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Log\Formatter;

/**
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface FormatterInterface
{
/**
* Formats data into a single line to be written by the writer.
*
* @param array $event event data
* @return string formatted line to write to the log
*/
public function format($event);
}
5 changes: 2 additions & 3 deletions src/Formatter/Simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

namespace Zend\Log\Formatter;

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

/**
* @category Zend
Expand All @@ -31,7 +30,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Simple implements Formatter
class Simple implements FormatterInterface
{
/**
* @var string
Expand Down
11 changes: 5 additions & 6 deletions src/Formatter/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@

namespace Zend\Log\Formatter;

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

/**
* @category Zend
Expand All @@ -34,7 +33,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Xml implements Formatter
class Xml implements FormatterInterface
{
/**
* @var string Name of root element
Expand Down
89 changes: 89 additions & 0 deletions src/LoggableInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* @namespace
*/
namespace Zend\Log;

/**
* @category Zend
* @package Zend_Log
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface LoggableInterface
{
/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function emerg($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function alert($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function crit($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function err($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function warn($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function notice($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function info($message, $extra = array());

/**
* @param string $message
* @param array|\Traversable $extra
* @return LoggabbleInterface
*/
public function debug($message, $extra = array());
}
Loading

0 comments on commit 9e57901

Please sign in to comment.