mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-26 06:32:49 +00:00
fix: follow main's log folders in the dashboard and UGC server
Servers now log to logs/<Server>/ (worlds to logs/WorldServer/<zone>/<clone>/) with the start time in the file name. The dashboard and UGC server log the same way, and the System Log page and log search read the whole folder tree instead of only the top of logs/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -228,12 +228,14 @@ namespace {
|
||||
uintmax_t size{};
|
||||
};
|
||||
|
||||
// Every log file, by server (the name before the start time, e.g. "WorldServer_1200_3"), newest first
|
||||
// Every log file, by server (the name before the start time, e.g. "WorldServer_1200_0_3"), newest first. Servers
|
||||
// write into their own folders (logs/WorldServer/<zone>/<clone>/, logs/AuthServer/, ...), so the whole tree is read.
|
||||
std::map<std::string, std::vector<LogFile>> LogFilesByServer() {
|
||||
std::map<std::string, std::vector<LogFile>> byServer;
|
||||
const auto logDir = BinaryPathFinder::GetBinaryDir() / "logs";
|
||||
std::error_code ec;
|
||||
for (const auto& entry : std::filesystem::directory_iterator(logDir, ec)) {
|
||||
for (auto it = std::filesystem::recursive_directory_iterator(logDir, ec); !ec && it != std::filesystem::recursive_directory_iterator(); it.increment(ec)) {
|
||||
const auto& entry = *it;
|
||||
if (!entry.is_regular_file(ec) || entry.path().extension() != ".log") continue;
|
||||
const auto stem = entry.path().stem().string();
|
||||
const auto written = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
|
||||
Reference in New Issue
Block a user