Skip to content

Commit

Permalink
Merge pull request enlitepro#6 from jgxvx/master
Browse files Browse the repository at this point in the history
Loading processors from service manager, if available
  • Loading branch information
Sysaninster committed May 4, 2015
2 parents dcc1a10 + 113a712 commit 85c4881
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/EnliteMonolog/Service/MonologServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


use Closure;
use Exception;
use Monolog\Logger;
use Monolog\Formatter\FormatterInterface;
use RuntimeException;
Expand Down Expand Up @@ -151,6 +152,16 @@ public function createProcessor(ServiceLocatorInterface $serviceLocator, $proces
}

if (is_string($processor)) {
try {
$instance = $serviceLocator->get($processor);
} catch (Exception $ex) {
$instance = null;
}

if ($instance && is_callable($instance)) {
return $instance;
}

$processor = new $processor();

if (is_callable($processor)) {
Expand Down

0 comments on commit 85c4881

Please sign in to comment.