Adds DI::flushLogger() to renew Logger instances

This commit is contained in:
Philipp 2021-10-31 20:15:57 +01:00
parent 7637ae1dcc
commit 32f0c3fb9c
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
3 changed files with 13 additions and 2 deletions

View file

@ -230,6 +230,18 @@ abstract class DI
// "LoggerInterface" instances
//
/**
* Flushes the Logger instance, so the factory is called again
* (creates a new id and retrieves the current PID)
*/
public static function flushLogger()
{
$flushDice = self::$dice
->addRule(LoggerInterface::class, self::$dice->getRule(LoggerInterface::class))
->addRule('$devLogger', self::$dice->getRule('$devLogger'));
static::init($flushDice);
}
/**
* @return LoggerInterface
*/