final class RotatingFileLogger extends AbstractLogger (View source)

Writes private daily JSON-line logs without following symbolic links or weakening filesystem permissions.

The containing directory must be a private local directory with mode 0700. Daily files retained or appended by this logger are restricted to mode 0600.

Constants

private MAX_CONTEXT_DEPTH

Methods

__construct(string $file, DirectoryManagerInterface $directoryManager, int $retentionDays = 7)

Configures one absolute local log path and the number of daily files retained by future writes.

void
log($level, Stringable|string $message, array $context = [])

Appends one complete record under an exclusive lock after enforcing directory and file privacy.

void

Details

__construct

__construct(string $file, DirectoryManagerInterface $directoryManager, int $retentionDays = 7)

Configures one absolute local log path and the number of daily files retained by future writes.

The signature remains suitable for direct construction, while framework-managed channels obtain their path from {\Lemonade\Framework\Core\Logging\LogFilePathResolver} to enforce storage containment and public-root separation.

Parameters

string $file
DirectoryManagerInterface $directoryManager
int $retentionDays

log

void log($level, Stringable|string $message, array $context = [])

Appends one complete record under an exclusive lock after enforcing directory and file privacy.

Parameters

$level
Stringable|string $message
array $context

Return Value

void

Exceptions

LogStorageException
JsonException
OverflowException