private readonly LoggerInterface
$logger,
private readonly int
$defaultFileRotationCount = 14
) { } /**
* @param value-of<Level::VALUES>|Level $loggerLevel
*/
public function createRotating(string
$filePrefix, ?int
$fileRotationCount = null, int|Level
$loggerLevel = Level::Debug
): LoggerInterface
{ $result =
new Logger($filePrefix);
$result->
pushProcessor(new PsrLogMessageProcessor());
/**
* Use RotatingFileHandler as fallback if Nullhandler or none is given
* If RotatingFileHandler is given (default configuration) -> use "default" logic for splitted logs
*/
if (!
method_exists($this->logger, 'getHandlers'
) || ( \
count($this->logger->
getHandlers() ?? 0
) === 1
&& ( current($this->logger->
getHandlers()) instanceof NullHandler
||
current($this->logger->
getHandlers()) instanceof RotatingFileHandler
)