diff --git a/Admin/Templates/debug_log.tpl b/Admin/Templates/debug_log.tpl new file mode 100644 index 00000000..f1b0e921 --- /dev/null +++ b/Admin/Templates/debug_log.tpl @@ -0,0 +1,146 @@ + + + + <?php echo ($_SESSION['access'] == ADMIN ? 'Admin Control Panel' : 'Multihunter Control Panel'); ?> - TravianZ + + + + + + + +getDebugMode(); +$isOn = !empty($cfg['active']); + +// Resolve project root (max 5 levels up) to find the log file. +$autoprefix = ''; +for ($i = 0; $i < 5; $i++) { + $autoprefix = str_repeat('../', $i); + if (file_exists($autoprefix . 'autoloader.php')) { + break; + } +} +$logFile = $autoprefix . 'var/log/debug-players.log'; + +// Read the last lines for the on-screen viewer. +$maxLines = 400; +$lines = []; +$logSize = 0; +if (is_file($logFile)) { + $logSize = filesize($logFile); + $all = file($logFile, FILE_IGNORE_NEW_LINES); + if ($all !== false) { + $lines = array_slice($all, -$maxLines); + } +} + +// Active-since label + auto-off info. +$since = !empty($cfg['started_at']) ? date('d.m.Y H:i', $cfg['started_at']) : '-'; +$autoOff = (int)($cfg['auto_off_hours'] ?? 0); +?> +
+ +
+

🐞 Debug Error Log

+ + + +
+ +
+

Status

+
+ Capture is . + Auto-off: 0 ? $autoOff.' h' : 'never'; ?> + Log size: KB +
+
+ + + +
+

Transparent to players: errors are only written to the log file, never shown in-game and gameplay is unaffected.

+
+ +
+

Capture settings

+
+ +
+ + + + +
+
+ + + +
+

Beyond the size cap the file is rotated to a single .log.1 backup, so the total volume stays bounded.

+
+
+ +
+

Last lines

+
+ ⬇ Download full log +
+ + +
+ ↻ Refresh +
+
+
+ +
diff --git a/Admin/admin.php b/Admin/admin.php index 33ed821c..19f1a1f0 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -147,6 +147,10 @@ if (!empty($_GET['p'])) { $subpage = 'Server Settings'; break; + case 'debug_log': + $subpage = 'Debug Error Log'; + break; + case 'editServerSet': $subpage = 'Server Configuration'; break; @@ -622,6 +626,7 @@ body.app #lmid3 a{color:#15803d !important;font-weight:600 !important;}
  • Admin