This repository has been archived by the owner on Jun 24, 2019. It is now read-only.
/
Configuration.php
60 lines (51 loc) · 1.73 KB
/
Configuration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
declare(strict_types=1);
/*
* (c) Christian Gripp <mail@core23.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Core23\MonologFilters\Bridge\Symfony\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
final class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('core23_monolog');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('core23_monolog');
} else {
$rootNode = $treeBuilder->getRootNode();
}
\assert($rootNode instanceof ArrayNodeDefinition);
$this->addLoggingSection($rootNode);
return $treeBuilder;
}
/**
* @param ArrayNodeDefinition $node
*/
private function addLoggingSection(ArrayNodeDefinition $node): void
{
$node
->children()
->arrayNode('handlers')
->addDefaultsIfNotSet()
->children()
->scalarNode('action_level')->defaultValue('WARNING')->end()
->arrayNode('excluded_404s')
->canBeUnset()
->defaultValue(['^/'])
->prototype('scalar')->end()
->end()
->end()
->end()
->end();
}
}