Skip to content

Commit 4b7adf9

Browse files
committed
Merge remote-tracking branch 'apfelbox/hipchat-config'
Conflicts: Resources/config/schema/monolog-1.0.xsd
2 parents dd62a3f + 831c031 commit 4b7adf9

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@
179179
* - [bubble]: bool, defaults to true
180180
* - [use_ssl]: bool, defaults to true
181181
* - [message_format]: text or html, defaults to text
182+
* - [host]: defaults to "api.hipchat.com"
183+
* - [api_version]: defaults to "v1"
182184
*
183185
* - slack:
184186
* - token: slack api token
@@ -330,6 +332,7 @@ public function getConfigTreeBuilder()
330332
->scalarNode('exchange_name')->defaultValue('log')->end() // amqp
331333
->scalarNode('room')->end() // hipchat
332334
->scalarNode('message_format')->defaultValue('text')->end() // hipchat
335+
->scalarNode('api_version')->defaultNull()->end() // hipchat
333336
->scalarNode('channel')->end() // slack
334337
->scalarNode('bot_name')->defaultValue('Monolog')->end() // slack
335338
->scalarNode('use_attachment')->defaultTrue()->end() // slack
@@ -350,7 +353,7 @@ public function getConfigTreeBuilder()
350353
->end()
351354
->end()
352355
->scalarNode('title')->defaultNull()->end() // pushover
353-
->scalarNode('host')->end() // syslogudp
356+
->scalarNode('host')->defaultNull()->end() // syslogudp & hipchat
354357
->scalarNode('port')->defaultValue(514)->end() // syslogudp
355358
->arrayNode('publisher')
356359
->canBeUnset()
@@ -654,6 +657,10 @@ public function getConfigTreeBuilder()
654657
->ifTrue(function ($v) { return 'hipchat' === $v['type'] && !in_array($v['message_format'], array('text', 'html')); })
655658
->thenInvalid('The message_format has to be "text" or "html" in a HipChatHandler')
656659
->end()
660+
->validate()
661+
->ifTrue(function ($v) { return 'hipchat' === $v['type'] && null !== $v['api_version'] && !in_array($v['api_version'], array('v1', 'v2'), true); })
662+
->thenInvalid('The api_version has to be "v1" or "v2" in a HipChatHandler')
663+
->end()
657664
->validate()
658665
->ifTrue(function ($v) { return 'slack' === $v['type'] && (empty($v['token']) || empty($v['channel'])); })
659666
->thenInvalid('The token and channel have to be specified to use a SlackHandler')

DependencyInjection/MonologExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
469469
$handler['bubble'],
470470
$handler['use_ssl'],
471471
$handler['message_format'],
472+
!empty($handler['host']) ? $handler['host'] : 'api.hipchat.com',
473+
!empty($handler['api_version']) ? $handler['api_version'] : 'v1',
472474
));
473475
break;
474476

Resources/config/schema/monolog-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<xsd:attribute name="document_type" type="xsd:string" />
7171
<xsd:attribute name="document-type" type="xsd:string" />
7272
<xsd:attribute name="ignore-error" type="xsd:string" />
73+
<xsd:attribute name="api_version" type="xsd:string" />
7374
</xsd:complexType>
7475

7576
<xsd:simpleType name="level">

0 commit comments

Comments
 (0)