3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Log\Writer
;
12 use Zend\Log\Exception
;
13 use Zend\Log\Formatter
;
14 use Zend\ServiceManager\AbstractPluginManager
;
16 class FormatterPluginManager
extends AbstractPluginManager
19 * Default set of formatters
23 protected $invokableClasses = array(
24 'base' => 'Zend\Log\Formatter\Base',
25 'simple' => 'Zend\Log\Formatter\Simple',
26 'xml' => 'Zend\Log\Formatter\Xml',
27 'db' => 'Zend\Log\Formatter\Db',
28 'errorhandler' => 'Zend\Log\Formatter\ErrorHandler',
29 'exceptionhandler' => 'Zend\Log\Formatter\ExceptionHandler',
33 * Allow many filters of the same type
37 protected $shareByDefault = false;
42 * Checks that the formatter loaded is an instance of Formatter\FormatterInterface.
44 * @param mixed $plugin
46 * @throws Exception\InvalidArgumentException if invalid
48 public function validatePlugin($plugin)
50 if ($plugin instanceof Formatter\FormatterInterface
) {
55 throw new Exception\
InvalidArgumentException(sprintf(
56 'Plugin of type %s is invalid; must implement %s\Formatter\FormatterInterface',
57 (is_object($plugin) ?
get_class($plugin) : gettype($plugin)),