Skip to content

Commit 635bb23

Browse files
committed
feature #312 add InsightOps support (tristanbes)
This PR was squashed before being merged into the 3.x-dev branch (closes #312). Discussion ---------- add InsightOps support closes #311 Commits ------- b15f98f add InsightOps support
2 parents 11821b7 + b15f98f commit 635bb23

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 3.5.0 (xxxx-xx-xx)
22

3-
* Add `sentry` type to use sentry 2.0 client
3+
* Added `sentry` type to use sentry 2.0 client
4+
* Added `insightops` handler
45

56
## 3.4.0 (2019-06-20)
67

DependencyInjection/Configuration.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@
295295
* - [timeout]: float
296296
* - [connection_timeout]: float
297297
*
298+
* - insightops:
299+
* - token: Log token supplied by InsightOps
300+
* - region: Region where InsightOps account is hosted. Could be 'us' or 'eu'. Defaults to 'us'
301+
* - [use_ssl]: whether or not SSL encryption should be used, defaults to true
302+
* - [level]: level name or int value, defaults to DEBUG
303+
* - [bubble]: bool, defaults to true
304+
*
298305
* - flowdock:
299306
* - token: flowdock api token
300307
* - source: human readable identifier of the application
@@ -455,9 +462,10 @@ public function getConfigTreeBuilder()
455462
->scalarNode('team')->end() // slackbot
456463
->scalarNode('notify')->defaultFalse()->end() // hipchat
457464
->scalarNode('nickname')->defaultValue('Monolog')->end() // hipchat
458-
->scalarNode('token')->end() // pushover & hipchat & loggly & logentries & flowdock & rollbar & slack & slackbot
465+
->scalarNode('token')->end() // pushover & hipchat & loggly & logentries & flowdock & rollbar & slack & slackbot & insightops
466+
->scalarNode('region')->end() // insightops
459467
->scalarNode('source')->end() // flowdock
460-
->booleanNode('use_ssl')->defaultTrue()->end() // logentries & hipchat
468+
->booleanNode('use_ssl')->defaultTrue()->end() // logentries & hipchat & insightops
461469
->variableNode('user') // pushover
462470
->validate()
463471
->ifTrue(function ($v) {
@@ -897,6 +905,10 @@ public function getConfigTreeBuilder()
897905
->ifTrue(function ($v) { return 'logentries' === $v['type'] && empty($v['token']); })
898906
->thenInvalid('The token has to be specified to use a LogEntriesHandler')
899907
->end()
908+
->validate()
909+
->ifTrue(function ($v) { return 'insightops' === $v['type'] && empty($v['token']); })
910+
->thenInvalid('The token has to be specified to use a InsightOpsHandler')
911+
->end()
900912
->validate()
901913
->ifTrue(function ($v) { return 'flowdock' === $v['type'] && empty($v['token']); })
902914
->thenInvalid('The token has to be specified to use a FlowdockHandler')

DependencyInjection/MonologExtension.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,16 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
764764
}
765765
break;
766766

767+
case 'insightops':
768+
$definition->setArguments(array(
769+
$handler['token'],
770+
$handler['region'] ? $handler['region'] : 'us',
771+
$handler['use_ssl'],
772+
$handler['level'],
773+
$handler['bubble'],
774+
));
775+
break;
776+
767777
case 'flowdock':
768778
$definition->setArguments(array(
769779
$handler['token'],
@@ -918,6 +928,7 @@ private function getHandlerClassByType($handlerType)
918928
'server_log' => 'Symfony\Bridge\Monolog\Handler\ServerLogHandler',
919929
'redis' => 'Monolog\Handler\RedisHandler',
920930
'predis' => 'Monolog\Handler\RedisHandler',
931+
'insightops' => 'Monolog\Handler\InsightOpsHandler',
921932
);
922933

923934
if (!isset($typeToClassMapping[$handlerType])) {

Resources/config/schema/monolog-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<xsd:attribute name="content-type" type="xsd:string" />
9090
<xsd:attribute name="webhook-url" type="xsd:string" />
9191
<xsd:attribute name="slack-team" type="xsd:string" />
92+
<xsd:attribute name="region" type="xsd:string" />
9293
</xsd:complexType>
9394

9495
<xsd:simpleType name="level">

0 commit comments

Comments
 (0)