Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/DependencyInjection/Compiler/AddProcessorsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function process(ContainerBuilder $container)

foreach ($tags as $tag) {
if (!empty($tag['channel']) && !empty($tag['handler'])) {
throw new \InvalidArgumentException(\sprintf('you cannot specify both the "handler" and "channel" attributes for the "monolog.processor" tag on service "%s"', $id));
throw new \InvalidArgumentException(\sprintf('you cannot specify both the "handler" and "channel" attributes for the "monolog.processor" tag on service "%s".', $id));
}

if (!empty($tag['handler'])) {
Expand All @@ -49,7 +49,7 @@ public function process(ContainerBuilder $container)
}
$class = $container->getParameterBag()->resolveValue($parentDef->getClass());
if (!method_exists($class, 'pushProcessor')) {
throw new \InvalidArgumentException(\sprintf('The "%s" handler does not accept processors', $tag['handler']));
throw new \InvalidArgumentException(\sprintf('The "%s" handler does not accept processors.', $tag['handler']));
}
} elseif (!empty($tag['channel'])) {
if ('app' === $tag['channel']) {
Expand Down
3 changes: 1 addition & 2 deletions src/DependencyInjection/Compiler/LoggerChannelPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ public function process(ContainerBuilder $container)
try {
$logger = $container->getDefinition('app' === $channel ? 'monolog.logger' : 'monolog.logger.'.$channel);
} catch (InvalidArgumentException $e) {
$msg = 'Monolog configuration error: The logging channel "'.$channel.'" assigned to the "'.substr($handler, 16).'" handler does not exist.';
throw new \InvalidArgumentException($msg, 0, $e);
throw new \InvalidArgumentException(\sprintf('Monolog configuration error: The logging channel "%s" assigned to the "%s" handler does not exist.', $channel, substr($handler, 16)), 0, $e);
}
$logger->addMethodCall('pushHandler', [new Reference($handler)]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->then(function ($v) {
$invalidTags = preg_grep('/^[a-z0-9][a-z0-9\.\-_]*$/i', $v['tags'], \PREG_GREP_INVERT);
if (!empty($invalidTags)) {
throw new InvalidConfigurationException(\sprintf('The following Loggly tags are invalid: %s.', implode(', ', $invalidTags)));
throw new InvalidConfigurationException(\sprintf('The following Loggly tags are invalid: "%s".', implode('", "', $invalidTags)));
}

return $v;
Expand Down Expand Up @@ -1124,7 +1124,7 @@ private function addChannelsSection(ArrayNodeDefinition $handlerNode)
$isExclusive = true;
} else {
if (true === $isExclusive) {
throw new InvalidConfigurationException('Cannot combine exclusive/inclusive definitions in channels list');
throw new InvalidConfigurationException('Cannot combine exclusive/inclusive definitions in channels list.');
}
$elements[] = $element;
$isExclusive = false;
Expand Down
6 changes: 3 additions & 3 deletions src/DependencyInjection/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler

$publisher->setPublic(false);
} else {
throw new \RuntimeException('The gelf handler requires the graylog2/gelf-php package to be installed');
throw new \RuntimeException('The gelf handler requires the graylog2/gelf-php package to be installed.');
}

$definition->setArguments([
Expand Down Expand Up @@ -330,7 +330,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler

case 'telegram':
if (!class_exists('Monolog\Handler\TelegramBotHandler')) {
throw new \RuntimeException('The TelegramBotHandler is not available. Please update "monolog/monolog" to 2.2.0');
throw new \RuntimeException('The TelegramBotHandler is not available. Please update "monolog/monolog" to 2.2.0.');
}

$definition->setArguments([
Expand Down Expand Up @@ -916,7 +916,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
$nullWarning = ', if you meant to define a null handler in a yaml config, make sure you quote "null" so it does not get converted to a php null';
}

throw new \InvalidArgumentException(\sprintf('Invalid handler type "%s" given for handler "%s"'.$nullWarning, $handler['type'], $name));
throw new \InvalidArgumentException(\sprintf('Invalid handler type "%s" given for handler "%s".'.$nullWarning, $handler['type'], $name));
}

if (!empty($handler['nested']) && true === $handler['nested']) {
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/MonologExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ public function testLogglyHandler()
]]]]);
$this->fail();
} catch (InvalidConfigurationException $e) {
$this->assertStringContainsString('-us, apache$', $e->getMessage());
$this->assertSame('The following Loggly tags are invalid: "-us", "apache$".', $e->getMessage());
}

$container = $this->getContainer([['handlers' => ['loggly' => [
Expand Down
Loading