mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Integrate Monolog: replace four logging systems with single PSR-3 factory
- Add monolog/monolog dependency (^3.10)
- Create app/Logger.php central factory with channels: app, admin, error, audit
- Each channel gets RotatingFileHandler (30-day retention) with pass-through LineFormatter
preserving existing JSON format contracts
- Rewrite AppLogger as thin facade delegating to Logger::get('app')
- Rewrite ErrorHandler::log() to delegate to Logger::get('error')
- Rewrite AdminLogger file output to delegate to Logger::get('admin'), keep DB writes
- Add Monolog file shadow to Audit via Logger::get('audit') (Option A per monolog-plan)
- Log level controlled by LOG_LEVEL env var (defaults: DEBUG in cli-server, WARNING otherwise)
- Graceful NullHandler fallback when log directory is not writable
- Update SystemController LOG_FILES: remove php_error, add app/admin/error/audit
- JSON app logs parsed to readable one-liners in the log viewer
- Remove nginx config tab (parametres + fragment + template + css)
- Friendly empty-state message when app log files don't exist yet (notYet)
- PHP tail fallback when exec() unavailable
- All 228 PHPUnit tests pass, no call sites changed
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
<?php if ($logFileMeta): ?>
|
||||
<div class="log-meta">
|
||||
<span data-label="Fichier"><?= htmlspecialchars(SystemController::LOG_FILES[$activeTab]['path']) ?></span>
|
||||
<span data-label="Fichier"><?= htmlspecialchars($logFileMeta['path']) ?></span>
|
||||
<span data-label="Taille"><?= $logFileMeta['size'] ?></span>
|
||||
<span data-label="Modifié"><?= $logFileMeta['mtime'] ?></span>
|
||||
</div>
|
||||
@@ -29,7 +29,7 @@
|
||||
<div class="log-unavailable">
|
||||
<strong>Journaux non disponibles</strong>
|
||||
<div class="log-unavail-path"><?= $logError ?></div>
|
||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||
<?php if (php_sapi_name() === 'cli-server' && str_starts_with($activeTab, 'nginx')): ?>
|
||||
<div class="log-unavail-dev">
|
||||
En environnement de développement, les logs nginx ne sont pas disponibles.
|
||||
Cette page est pleinement fonctionnelle sur le serveur de production.
|
||||
@@ -37,6 +37,12 @@
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php elseif (!empty($notYet)): ?>
|
||||
<div class="log-empty">
|
||||
Aucune entrée pour le moment.<br>
|
||||
<span class="log-unavail-path">Le journal sera créé automatiquement au premier événement.</span>
|
||||
</div>
|
||||
|
||||
<?php elseif (empty($logLines)): ?>
|
||||
<div class="log-empty">Le fichier journal est vide.</div>
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php if ($nginxConfigMeta): ?>
|
||||
<div class="log-meta">
|
||||
<span data-label="Fichier"><?= htmlspecialchars($nginxConfigMeta['path']) ?></span>
|
||||
<span data-label="Taille"><?= $nginxConfigMeta['size'] ?></span>
|
||||
<span data-label="Modifié"><?= $nginxConfigMeta['mtime'] ?></span>
|
||||
<?php if ($nginxConfigSource === 'live'): ?>
|
||||
<span class="nginx-source-badge nginx-source-badge--live">● Config déployée</span>
|
||||
<?php else: ?>
|
||||
<span class="nginx-source-badge nginx-source-badge--local">⚠ Référence locale (config live inaccessible)</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($nginxConfigError !== null): ?>
|
||||
<div class="log-unavailable">
|
||||
<strong>Configuration nginx non disponible</strong>
|
||||
<div class="log-unavail-path"><?= htmlspecialchars($nginxConfigError) ?></div>
|
||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||
<div class="log-unavail-dev">
|
||||
En développement, <code>/etc/nginx/sites-available/xamxam</code> n'existe pas.
|
||||
La config de référence se trouve dans <code>nginx/xamxam.conf</code>.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php elseif (empty($nginxConfigLines)): ?>
|
||||
<div class="log-empty">Le fichier de configuration est vide.</div>
|
||||
|
||||
<?php else: ?>
|
||||
<div class="log-output" id="log-output" role="region" aria-label="Configuration nginx">
|
||||
<button class="btn btn--secondary btn--sm log-copy-btn" id="log-copy-btn" type="button" title="Copier la configuration"
|
||||
onclick="copyLogContent(this);return false">
|
||||
Copier
|
||||
</button>
|
||||
<?php foreach ($nginxConfigLines as $i => $line): ?>
|
||||
<span class="log-line <?= SystemController::nginxLineClass($line) ?>"
|
||||
data-n="<?= $i + 1 ?>"><?= htmlspecialchars($line, ENT_QUOTES | ENT_SUBSTITUTE) ?></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user