Skip to content

Commit

Permalink
add InsightOps support
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanbes authored and lyrixx committed Aug 14, 2019
1 parent 11821b7 commit b15f98f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 3.5.0 (xxxx-xx-xx)

* Add `sentry` type to use sentry 2.0 client
* Added `sentry` type to use sentry 2.0 client
* Added `insightops` handler

## 3.4.0 (2019-06-20)

Expand Down
16 changes: 14 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@
* - [timeout]: float
* - [connection_timeout]: float
*
* - insightops:
* - token: Log token supplied by InsightOps
* - region: Region where InsightOps account is hosted. Could be 'us' or 'eu'. Defaults to 'us'
* - [use_ssl]: whether or not SSL encryption should be used, defaults to true
* - [level]: level name or int value, defaults to DEBUG
* - [bubble]: bool, defaults to true
*
* - flowdock:
* - token: flowdock api token
* - source: human readable identifier of the application
Expand Down Expand Up @@ -455,9 +462,10 @@ public function getConfigTreeBuilder()
->scalarNode('team')->end() // slackbot
->scalarNode('notify')->defaultFalse()->end() // hipchat
->scalarNode('nickname')->defaultValue('Monolog')->end() // hipchat
->scalarNode('token')->end() // pushover & hipchat & loggly & logentries & flowdock & rollbar & slack & slackbot
->scalarNode('token')->end() // pushover & hipchat & loggly & logentries & flowdock & rollbar & slack & slackbot & insightops
->scalarNode('region')->end() // insightops
->scalarNode('source')->end() // flowdock
->booleanNode('use_ssl')->defaultTrue()->end() // logentries & hipchat
->booleanNode('use_ssl')->defaultTrue()->end() // logentries & hipchat & insightops
->variableNode('user') // pushover
->validate()
->ifTrue(function ($v) {
Expand Down Expand Up @@ -897,6 +905,10 @@ public function getConfigTreeBuilder()
->ifTrue(function ($v) { return 'logentries' === $v['type'] && empty($v['token']); })
->thenInvalid('The token has to be specified to use a LogEntriesHandler')
->end()
->validate()
->ifTrue(function ($v) { return 'insightops' === $v['type'] && empty($v['token']); })
->thenInvalid('The token has to be specified to use a InsightOpsHandler')
->end()
->validate()
->ifTrue(function ($v) { return 'flowdock' === $v['type'] && empty($v['token']); })
->thenInvalid('The token has to be specified to use a FlowdockHandler')
Expand Down
11 changes: 11 additions & 0 deletions DependencyInjection/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,16 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
}
break;

case 'insightops':
$definition->setArguments(array(
$handler['token'],
$handler['region'] ? $handler['region'] : 'us',
$handler['use_ssl'],
$handler['level'],
$handler['bubble'],
));
break;

case 'flowdock':
$definition->setArguments(array(
$handler['token'],
Expand Down Expand Up @@ -918,6 +928,7 @@ private function getHandlerClassByType($handlerType)
'server_log' => 'Symfony\Bridge\Monolog\Handler\ServerLogHandler',
'redis' => 'Monolog\Handler\RedisHandler',
'predis' => 'Monolog\Handler\RedisHandler',
'insightops' => 'Monolog\Handler\InsightOpsHandler',
);

if (!isset($typeToClassMapping[$handlerType])) {
Expand Down
1 change: 1 addition & 0 deletions Resources/config/schema/monolog-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<xsd:attribute name="content-type" type="xsd:string" />
<xsd:attribute name="webhook-url" type="xsd:string" />
<xsd:attribute name="slack-team" type="xsd:string" />
<xsd:attribute name="region" type="xsd:string" />
</xsd:complexType>

<xsd:simpleType name="level">
Expand Down

0 comments on commit b15f98f

Please sign in to comment.