API / Minn\Ops / Logs

Logs final readonly class

Minn\Ops\Logs · public/minn/src/Minn/Ops/Logs.php · 150 lines

The log files the System view can read and clear: the debug log the engine's failure handler writes, and PHP's own error log when it is a separate file inside the site. Anything outside the site is named but never read; it may be another tenant's.

Uses 1

Constants and properties

privateTAIL_BYTES = 262144
privatereadonly string $webroot

Promoted from the constructor.

Public

new__construct(string $webroot)#
methodsources(): array#

Every log the engine knows about, with its path and group.

@return array<string, array{label: string, group: string, path: string}>
methodlistPayload(): array#

The logs list as the System view shows it.

@return list<array> the sources that exist, debug first
methodread(string $id): array#

One log's tail, by id.

methodclear(string $id): void#

Empties one log.

methoddebugLogPath(): string#

Where debug.log lives, from WP_DEBUG_LOG or the default.

methodtail(string $path): array#

The last TAIL_BYTES of a file, the partial first line dropped.

methodowned(string $path): bool#

True when the path resolves inside the webroot.

statichuman(int $bytes): string#

A byte count in KB, MB, or GB.