This commit is contained in:
2026-05-28 20:19:28 +08:00
commit 070fad058f
124 changed files with 22713 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace LayLink\Audit;
final class AuditLogger
{
public function __construct(private readonly string $path)
{
$dir = dirname($this->path);
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
}
public function write(array $record): void
{
$record += [
'end_time' => date(DATE_ATOM),
];
file_put_contents(
$this->path,
json_encode($record, JSON_UNESCAPED_SLASHES) . PHP_EOL,
FILE_APPEND | LOCK_EX,
);
}
}