|
88 | 88 | * - [level]: level name or int value, defaults to DEBUG
|
89 | 89 | * - [bubble]: bool, defaults to true
|
90 | 90 | *
|
| 91 | + * - redis: |
| 92 | + * - redis: |
| 93 | + * - id: optional if host is given |
| 94 | + * - host: 127.0.0.1 |
| 95 | + * - password: null |
| 96 | + * - port: 6379 |
| 97 | + * - database: 0 |
| 98 | + * - key_name: monolog_redis |
| 99 | + * |
| 100 | + * - predis: |
| 101 | + * - redis: |
| 102 | + * - id: optional if host is given |
| 103 | + * - host: tcp://10.0.0.1:6379 |
| 104 | + * - key_name: monolog_redis |
| 105 | + * |
91 | 106 | * - fingers_crossed:
|
92 | 107 | * - handler: the wrapped handler's name
|
93 | 108 | * - [action_level|activation_strategy]: minimum level or service id to activate the handler, defaults to WARNING
|
@@ -522,6 +537,44 @@ public function getConfigTreeBuilder()
|
522 | 537 | ->scalarNode('index')->defaultValue('monolog')->end() // elasticsearch
|
523 | 538 | ->scalarNode('document_type')->defaultValue('logs')->end() // elasticsearch
|
524 | 539 | ->scalarNode('ignore_error')->defaultValue(false)->end() // elasticsearch
|
| 540 | + ->arrayNode('redis') |
| 541 | + ->canBeUnset() |
| 542 | + ->beforeNormalization() |
| 543 | + ->ifString() |
| 544 | + ->then(function ($v) { return array('id' => $v); }) |
| 545 | + ->end() |
| 546 | + ->children() |
| 547 | + ->scalarNode('id')->end() |
| 548 | + ->scalarNode('host')->end() |
| 549 | + ->scalarNode('password')->defaultNull()->end() |
| 550 | + ->scalarNode('port')->defaultValue(6379)->end() |
| 551 | + ->scalarNode('database')->defaultValue(0)->end() |
| 552 | + ->scalarNode('key_name')->defaultValue('monolog_redis')->end() |
| 553 | + ->end() |
| 554 | + ->validate() |
| 555 | + ->ifTrue(function ($v) { |
| 556 | + return !isset($v['id']) && !isset($v['host']); |
| 557 | + }) |
| 558 | + ->thenInvalid('What must be set is either the host or the service id of the Redis client.') |
| 559 | + ->end() |
| 560 | + ->end() // redis |
| 561 | + ->arrayNode('predis') |
| 562 | + ->canBeUnset() |
| 563 | + ->beforeNormalization() |
| 564 | + ->ifString() |
| 565 | + ->then(function ($v) { return array('id' => $v); }) |
| 566 | + ->end() |
| 567 | + ->children() |
| 568 | + ->scalarNode('id')->end() |
| 569 | + ->scalarNode('host')->end() |
| 570 | + ->end() |
| 571 | + ->validate() |
| 572 | + ->ifTrue(function ($v) { |
| 573 | + return !isset($v['id']) && !isset($v['host']); |
| 574 | + }) |
| 575 | + ->thenInvalid('What must be set is either the host or the service id of the Predis client.') |
| 576 | + ->end() |
| 577 | + ->end() // predis |
525 | 578 | ->arrayNode('config')
|
526 | 579 | ->canBeUnset()
|
527 | 580 | ->prototype('scalar')->end()
|
@@ -849,6 +902,14 @@ public function getConfigTreeBuilder()
|
849 | 902 | ->ifTrue(function ($v) { return 'server_log' === $v['type'] && empty($v['host']); })
|
850 | 903 | ->thenInvalid('The host has to be specified to use a ServerLogHandler')
|
851 | 904 | ->end()
|
| 905 | + ->validate() |
| 906 | + ->ifTrue(function ($v) { return 'redis' === $v['type'] && empty($v['redis']); }) |
| 907 | + ->thenInvalid('The host has to be specified to use a RedisLogHandler') |
| 908 | + ->end() |
| 909 | + ->validate() |
| 910 | + ->ifTrue(function ($v) { return 'predis' === $v['type'] && empty($v['redis']); }) |
| 911 | + ->thenInvalid('The host has to be specified to use a RedisLogHandler') |
| 912 | + ->end() |
852 | 913 | ->end()
|
853 | 914 | ->validate()
|
854 | 915 | ->ifTrue(function ($v) { return isset($v['debug']); })
|
|
0 commit comments