f7cloud_client/apps/mail/lib/Sieve/SieveLogger.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

33 lines
663 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Mail\Sieve;
class SieveLogger {
/** @var resource */
protected $stream;
public function __construct(string $logFile) {
$stream = @fopen($logFile, 'ab');
if ($stream === false) {
throw new \InvalidArgumentException('Unable to use "' . $logFile . '" as log file for sieve.');
}
$this->stream = $stream;
}
public function debug(string $message): void {
fwrite($this->stream, $message);
}
public function __destruct() {
fflush($this->stream);
fclose($this->stream);
}
}