refactor: documents
All checks were successful
JS Unit Tests / test (pull_request) Successful in 21s
Build Test / build (pull_request) Successful in 25s
PHP Unit Tests / test (pull_request) Successful in 46s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-03 22:13:36 -05:00
parent 85e89dca87
commit 1f3e87535b
45 changed files with 1667 additions and 676 deletions

View File

@@ -40,11 +40,18 @@ class FileLogger implements LoggerInterface
public function log($level, $message, array $context = []): void
{
$timestamp = $this->formatTimestamp();
$interpolated = $this->interpolate((string)$message, $context);
// Extract tenant id injected by TenantAwareLogger; default to 'system'.
$tenantId = isset($context['__tenant']) && is_string($context['__tenant'])
? $context['__tenant']
: 'system';
unset($context['__tenant']);
$timestamp = $this->formatTimestamp();
$interpolated = $this->interpolate((string) $message, $context);
$payload = [
'time' => $timestamp,
'level' => strtolower((string)$level),
'time' => $timestamp,
'level' => strtolower((string) $level),
'tenant' => $tenantId,
'channel' => $this->channel,
'message' => $interpolated,
'context' => $this->sanitizeContext($context),
@@ -53,11 +60,12 @@ class FileLogger implements LoggerInterface
if ($json === false) {
// Fallback stringify if encoding fails (should be rare)
$json = json_encode([
'time' => $timestamp,
'level' => strtolower((string)$level),
'channel' => $this->channel,
'message' => $interpolated,
'context_error' => 'failed to encode context: '.json_last_error_msg(),
'time' => $timestamp,
'level' => strtolower((string) $level),
'tenant' => $tenantId,
'channel' => $this->channel,
'message' => $interpolated,
'context_error' => 'failed to encode context: ' . json_last_error_msg(),
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?: '{"error":"logging failure"}';
}
$this->write($json);