Logger/MailCatcherLogger.php
<?php
/**
* MailCatcherLogger
*
* @copyright Copyright © 2017 Staempfli AG. All rights reserved.
* @author juan.alonso@gmail.com
*/
namespace Staempfli\MailCatcher\Logger;
use Monolog\Logger;
use Staempfli\MailCatcher\Logger\Handler\HandlerFactory;
class MailCatcherLogger extends Logger
{
/**
* @var array
*/
protected $defaultHandlerTypes = [
'error',
'info',
'debug'
];
/**
* {@inheritdoc}
*/
public function __construct(
HandlerFactory $handlerFactory,
$name = 'mailcatcher',
array $handlers = [],
array $processors = []
) {
foreach ($this->defaultHandlerTypes as $handlerType) {
if (!array_key_exists($handlerType, $handlers)) {
$handlers[$handlerType] = $handlerFactory->create($handlerType);
}
}
parent::__construct($name, $handlers, $processors);
}
}