Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/schema/monolog-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<xsd:attribute name="slack-team" type="xsd:string" />
<xsd:attribute name="region" type="xsd:string" />
<xsd:attribute name="enabled" type="xsd:boolean" />
<xsd:attribute name="handler_class" type="xsd:string" />
</xsd:complexType>

<xsd:simpleType name="level">
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->scalarNode('formatter')->end()
->booleanNode('nested')->defaultFalse()->end()
->scalarNode('handler_class')->defaultNull()->end()
->end();

$this->addGelfSection($handlerNode);
Expand Down
10 changes: 9 additions & 1 deletion src/DependencyInjection/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,15 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
return $handlerId;
}

$handlerClass = $this->getHandlerClassByType($handler['type']);
if (null !== $handler['handler_class']) {
$handlerClass = $handler['handler_class'];
if (!class_exists($handlerClass)) {
throw new \RuntimeException(\sprintf('The handler class "%s" does not exist.', $handlerClass));
}
} else {
$handlerClass = $this->getHandlerClassByType($handler['type']);
}

$definition = new Definition($handlerClass);

if ($handler['include_stacktraces']) {
Expand Down