Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codechange: Reshuffle debuglevels in fileio to address spammyness #10240

Merged
merged 1 commit into from Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/fileio.cpp
Expand Up @@ -418,7 +418,7 @@ uint TarScanner::DoScan(Subdirectory sd)

/* static */ uint TarScanner::DoScan(TarScanner::Mode mode)
{
Debug(misc, 1, "Scanning for tars");
Debug(misc, 2, "Scanning for tars");
TarScanner fs;
uint num = 0;
if (mode & TarScanner::BASESET) {
Expand All @@ -439,7 +439,7 @@ uint TarScanner::DoScan(Subdirectory sd)
num += fs.DoScan(SCENARIO_DIR);
num += fs.DoScan(HEIGHTMAP_DIR);
}
Debug(misc, 1, "Scan complete, found {} files", num);
Debug(misc, 2, "Scan complete, found {} files", num);
return num;
}

Expand Down Expand Up @@ -571,7 +571,7 @@ bool TarScanner::AddFile(const std::string &filename, size_t basepath_length, co

/* Only allow relative links */
if (link[0] == PATHSEPCHAR) {
Debug(misc, 1, "Ignoring absolute link in tar: {} -> {}", name, link);
Debug(misc, 5, "Ignoring absolute link in tar: {} -> {}", name, link);
break;
}

Expand All @@ -597,7 +597,7 @@ bool TarScanner::AddFile(const std::string &filename, size_t basepath_length, co
} else if (strcmp(pos, "..") == 0) {
/* level up */
if (dest[0] == '\0') {
Debug(misc, 1, "Ignoring link pointing outside of data directory: {} -> {}", name, link);
Debug(misc, 5, "Ignoring link pointing outside of data directory: {} -> {}", name, link);
break;
}

Expand Down Expand Up @@ -652,7 +652,7 @@ bool TarScanner::AddFile(const std::string &filename, size_t basepath_length, co
pos += skip;
}

Debug(misc, 1, "Found tar '{}' with {} new files", filename, num);
Debug(misc, 4, "Found tar '{}' with {} new files", filename, num);
fclose(f);

/* Resolve file links and store directory links.
Expand Down Expand Up @@ -690,7 +690,7 @@ bool ExtractTar(const std::string &tar_filename, Subdirectory subdir)

/* The file doesn't have a sub directory! */
if (dirname.empty()) {
Debug(misc, 1, "Extracting {} failed; archive rejected, the contents must be in a sub directory", tar_filename);
Debug(misc, 3, "Extracting {} failed; archive rejected, the contents must be in a sub directory", tar_filename);
return false;
}

Expand Down Expand Up @@ -987,7 +987,7 @@ void DeterminePaths(const char *exe, bool only_local_path)

for (Searchpath sp : _valid_searchpaths) {
if (sp == SP_WORKING_DIR && !_do_scan_working_directory) continue;
Debug(misc, 4, "{} added as search path", _searchpaths[sp]);
Debug(misc, 3, "{} added as search path", _searchpaths[sp]);
}

std::string config_dir;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ void DeterminePaths(const char *exe, bool only_local_path)
_config_file = config_dir + "openttd.cfg";
}

Debug(misc, 3, "{} found as config directory", config_dir);
Debug(misc, 1, "{} found as config directory", config_dir);

_highscore_file = config_dir + "hs.dat";
extern std::string _hotkeys_file;
Expand Down Expand Up @@ -1056,7 +1056,7 @@ void DeterminePaths(const char *exe, bool only_local_path)
FioCreateDirectory(_personal_dir);
#endif

Debug(misc, 3, "{} found as personal directory", _personal_dir);
Debug(misc, 1, "{} found as personal directory", _personal_dir);

static const Subdirectory default_subdirs[] = {
SAVE_DIR, AUTOSAVE_DIR, SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR, GAME_DIR, GAME_LIBRARY_DIR, SCREENSHOT_DIR
Expand All @@ -1068,7 +1068,7 @@ void DeterminePaths(const char *exe, bool only_local_path)

/* If we have network we make a directory for the autodownloading of content */
_searchpaths[SP_AUTODOWNLOAD_DIR] = _personal_dir + "content_download" PATHSEP;
Debug(misc, 4, "{} added as search path", _searchpaths[SP_AUTODOWNLOAD_DIR]);
Debug(misc, 3, "{} added as search path", _searchpaths[SP_AUTODOWNLOAD_DIR]);
FioCreateDirectory(_searchpaths[SP_AUTODOWNLOAD_DIR]);
FillValidSearchPaths(only_local_path);

Expand Down