-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement comprehensive container logging for compiler passes
- Loading branch information
1 parent
7c0f500
commit 86329e3
Showing
6 changed files
with
46 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Liip\ImagineBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
abstract class AbstractCompilerPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function log(ContainerBuilder $container, $message, array $replacements = array()) | ||
{ | ||
if (count($replacements) > 0) { | ||
$message = vsprintf($message, $replacements); | ||
} | ||
|
||
if (method_exists($container, 'log')) { | ||
$container->log($this, $message); | ||
} else { | ||
$compiler = $container->getCompiler(); | ||
$formatter = $compiler->getLoggingFormatter(); | ||
$compiler->addLogMessage($formatter->format($this, $message)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
|
||
namespace Liip\ImagineBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
|
@@ -20,7 +19,7 @@ | |
* | ||
* @author Konstantin Tjuterev <[email protected]> | ||
*/ | ||
class PostProcessorsCompilerPass implements CompilerPassInterface | ||
class PostProcessorsCompilerPass extends AbstractCompilerPass | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
@@ -33,6 +32,7 @@ public function process(ContainerBuilder $container) | |
$manager = $container->getDefinition('liip_imagine.filter.manager'); | ||
|
||
foreach ($tags as $id => $tag) { | ||
$this->log($container, 'Registering imagine filter post-processor: %s', array($id)); | ||
$manager->addMethodCall('addPostProcessor', array($tag[0]['post_processor'], new Reference($id))); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters