Skip to content

Commit

Permalink
Allow command classes to set their own logger channel (#5963)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenhaas committed May 2, 2024
1 parent 72da139 commit f98235d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Commands/DrushCommands.php
Expand Up @@ -69,7 +69,7 @@ protected function io(): DrushStyle
/**
* Returns a logger object.
*/
protected function logger(): ?DrushLoggerManager
public function logger(): ?DrushLoggerManager
{
return $this->logger;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/ServiceManager.php
Expand Up @@ -451,7 +451,7 @@ public function inflect(DrushContainer $container, $object): void
if ($object instanceof ConfigAwareInterface) {
$object->setConfig($container->get('config'));
}
if ($object instanceof LoggerAwareInterface) {
if ($object instanceof LoggerAwareInterface && (!method_exists($object, 'logger') || empty($object->logger()))) {
$object->setLogger($container->get('logger'));
}
// Made available by DrushCommands (must preserve for basic bc)
Expand Down

0 comments on commit f98235d

Please sign in to comment.