|
168 | 168 | * - [level]: level name or int value, defaults to DEBUG |
169 | 169 | * - [bubble]: bool, defaults to true |
170 | 170 | * |
| 171 | + * - loggly: |
| 172 | + * - token: loggly api token |
| 173 | + * - [level]: level name or int value, defaults to DEBUG |
| 174 | + * - [bubble]: bool, defaults to true |
| 175 | + * - [tags]: tag names |
171 | 176 | * |
172 | 177 | * @author Jordi Boggiano <[email protected]> |
173 | 178 | * @author Christophe Coevoet <[email protected]> |
@@ -198,6 +203,7 @@ public function getConfigTreeBuilder() |
198 | 203 | ->prototype('array') |
199 | 204 | ->fixXmlConfig('member') |
200 | 205 | ->fixXmlConfig('excluded_404') |
| 206 | + ->fixXmlConfig('tag') |
201 | 207 | ->canBeUnset() |
202 | 208 | ->children() |
203 | 209 | ->scalarNode('type') |
@@ -232,7 +238,7 @@ public function getConfigTreeBuilder() |
232 | 238 | ->scalarNode('room')->end() // hipchat |
233 | 239 | ->scalarNode('notify')->defaultFalse()->end() // hipchat |
234 | 240 | ->scalarNode('nickname')->defaultValue('Monolog')->end() // hipchat |
235 | | - ->scalarNode('token')->end() // pushover & hipchat |
| 241 | + ->scalarNode('token')->end() // pushover & hipchat & loggly |
236 | 242 | ->variableNode('user') // pushover |
237 | 243 | ->validate() |
238 | 244 | ->ifTrue(function($v) { |
@@ -322,6 +328,17 @@ public function getConfigTreeBuilder() |
322 | 328 | ->booleanNode('persistent')->end() // socket_handler |
323 | 329 | ->scalarNode('dsn')->end() // raven_handler |
324 | 330 | ->scalarNode('message_type')->defaultValue(0)->end() // error_log |
| 331 | + ->arrayNode('tags') // loggly |
| 332 | + ->beforeNormalization() |
| 333 | + ->ifString() |
| 334 | + ->then(function($v) { return explode(',', $v); }) |
| 335 | + ->end() |
| 336 | + ->beforeNormalization() |
| 337 | + ->ifArray() |
| 338 | + ->then(function($v) { return array_filter(array_map('trim', $v)); }) |
| 339 | + ->end() |
| 340 | + ->prototype('scalar')->end() |
| 341 | + ->end() |
325 | 342 | ->arrayNode('verbosity_levels') // console |
326 | 343 | ->beforeNormalization() |
327 | 344 | ->ifArray() |
@@ -490,6 +507,21 @@ public function getConfigTreeBuilder() |
490 | 507 | ->ifTrue(function($v) { return 'amqp' === $v['type'] && empty($v['exchange']); }) |
491 | 508 | ->thenInvalid('The exchange has to be specified to use a AmqpHandler') |
492 | 509 | ->end() |
| 510 | + ->validate() |
| 511 | + ->ifTrue(function($v) { return 'loggly' === $v['type'] && empty($v['token']); }) |
| 512 | + ->thenInvalid('The token has to be specified to use a LogglyHandler') |
| 513 | + ->end() |
| 514 | + ->validate() |
| 515 | + ->ifTrue(function($v) { return 'loggly' === $v['type'] && !empty($v['tags']); }) |
| 516 | + ->then(function($v) { |
| 517 | + $invalidTags = preg_grep('/^[a-z0-9][a-z0-9\.\-_]*$/i', $v['tags'], PREG_GREP_INVERT); |
| 518 | + if (!empty($invalidTags)) { |
| 519 | + throw new InvalidConfigurationException(sprintf('The following Loggly tags are invalid: %s.', implode(', ', $invalidTags))); |
| 520 | + } |
| 521 | + |
| 522 | + return $v; |
| 523 | + }) |
| 524 | + ->end() |
493 | 525 | ->end() |
494 | 526 | ->validate() |
495 | 527 | ->ifTrue(function($v) { return isset($v['debug']); }) |
|
0 commit comments