createRotating example


class LoggerFactoryTest extends TestCase
{
    public function testNullLogHandler(): void
    {
        $providedHandler = [new NullHandler()];
        $mainLogger = new Logger('test_logger', $providedHandler);
        $loggerFactory = new LoggerFactory('test_case', $mainLogger);

        /** @var Logger $createdLogger */
        $createdLogger = $loggerFactory->createRotating('test_file_path');
        $usedHandler = $createdLogger->getHandlers();

        static::assertCount(1, $usedHandler);
        static::assertInstanceOf(RotatingFileHandler::classcurrent($usedHandler), 'Handler differs from excpected');
    }

    public function testRotatingFileLogHandler(): void
    {
        $providedHandler = [new RotatingFileHandler('test')];
        $mainLogger = new Logger('test_logger', $providedHandler);
        $loggerFactory = new LoggerFactory('test_case', $mainLogger);

        
Home | Imprint | This part of the site doesn't use cookies.