<?php

namespace Leadlion\AutoRelated\Logger;

use Magento\Framework\Filesystem\DriverInterface;
use Monolog\Logger;

use Magento\Framework\Logger\Handler\Base;

class Handler extends Base
{
    const LOG_FILENAME_FORMAT = '/var/log/autoRelated/autorel_%s_%s_%s.log';


    /**
     * Handler constructor.
     * @param DriverInterface $filesystem
     * @param string|null $filePath
     * @param string|null $fileName
     */
    public function __construct(DriverInterface $filesystem, ?string $filePath = null, ?string $fileName = null)
    {
        if (!$fileName) {
            $fileName = sprintf(self::LOG_FILENAME_FORMAT, date('d'), date('m'), date('Y'));
        }

        parent::__construct($filesystem, $filePath, $fileName);
    }
}
