File: //usr/local/CyberCP/public/snappymail/snappymail/v/2.38.2/app/libraries/MailSo/Log/Drivers/File.php
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Log\Drivers;
/**
* @category MailSo
* @package Log
* @subpackage Drivers
*/
class File extends \MailSo\Log\Driver
{
private string $sLoggerFileName;
function __construct(string $sLoggerFileName)
{
parent::__construct();
$sLogFileDir = \dirname($sLoggerFileName);
if (!\is_dir($sLogFileDir)) {
\mkdir($sLogFileDir, 0755, true);
}
$this->sLoggerFileName = $sLoggerFileName;
}
protected function writeImplementation($mDesc) : bool
{
if (\is_array($mDesc)) {
$mDesc = \implode("\n\t", $mDesc);
}
return \error_log($mDesc . "\n", 3, $this->sLoggerFileName);
}
protected function clearImplementation() : bool
{
return \unlink($this->sLoggerFileName);
}
}