1
0
Fork 0
forked from suyu/suyu

Merge pull request #2618 from wwylele/log-less-filename

Reduce host file name and path logging
This commit is contained in:
bunnei 2017-03-16 23:35:36 -04:00 committed by GitHub
commit 3e7459bbf9
7 changed files with 20 additions and 17 deletions

View file

@ -118,8 +118,7 @@ bool IsDirectory(const std::string& filename) {
#endif #endif
if (result < 0) { if (result < 0) {
LOG_WARNING(Common_Filesystem, "stat failed on %s: %s", filename.c_str(), LOG_DEBUG(Common_Filesystem, "stat failed on %s: %s", filename.c_str(), GetLastErrorMsg());
GetLastErrorMsg());
return false; return false;
} }
@ -129,12 +128,12 @@ bool IsDirectory(const std::string& filename) {
// Deletes a given filename, return true on success // Deletes a given filename, return true on success
// Doesn't supports deleting a directory // Doesn't supports deleting a directory
bool Delete(const std::string& filename) { bool Delete(const std::string& filename) {
LOG_INFO(Common_Filesystem, "file %s", filename.c_str()); LOG_TRACE(Common_Filesystem, "file %s", filename.c_str());
// Return true because we care about the file no // Return true because we care about the file no
// being there, not the actual delete. // being there, not the actual delete.
if (!Exists(filename)) { if (!Exists(filename)) {
LOG_WARNING(Common_Filesystem, "%s does not exist", filename.c_str()); LOG_DEBUG(Common_Filesystem, "%s does not exist", filename.c_str());
return true; return true;
} }
@ -169,8 +168,7 @@ bool CreateDir(const std::string& path) {
return true; return true;
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) { if (error == ERROR_ALREADY_EXISTS) {
LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists", LOG_DEBUG(Common_Filesystem, "CreateDirectory failed on %s: already exists", path.c_str());
path.c_str());
return true; return true;
} }
LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error); LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error);
@ -182,7 +180,7 @@ bool CreateDir(const std::string& path) {
int err = errno; int err = errno;
if (err == EEXIST) { if (err == EEXIST) {
LOG_WARNING(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str()); LOG_DEBUG(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str());
return true; return true;
} }
@ -197,7 +195,7 @@ bool CreateFullPath(const std::string& fullPath) {
LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str()); LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str());
if (FileUtil::Exists(fullPath)) { if (FileUtil::Exists(fullPath)) {
LOG_WARNING(Common_Filesystem, "path exists %s", fullPath.c_str()); LOG_DEBUG(Common_Filesystem, "path exists %s", fullPath.c_str());
return true; return true;
} }
@ -229,7 +227,7 @@ bool CreateFullPath(const std::string& fullPath) {
// Deletes a directory filename, returns true on success // Deletes a directory filename, returns true on success
bool DeleteDir(const std::string& filename) { bool DeleteDir(const std::string& filename) {
LOG_INFO(Common_Filesystem, "directory %s", filename.c_str()); LOG_TRACE(Common_Filesystem, "directory %s", filename.c_str());
// check if a directory // check if a directory
if (!FileUtil::IsDirectory(filename)) { if (!FileUtil::IsDirectory(filename)) {
@ -693,6 +691,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new
paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
if (!FileUtil::IsDirectory(paths[D_USER_IDX])) { if (!FileUtil::IsDirectory(paths[D_USER_IDX])) {
paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP; paths[D_USER_IDX] = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP;
} else {
LOG_INFO(Common_Filesystem, "Using the local user directory");
} }
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;

View file

@ -173,7 +173,7 @@ Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {
ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location, ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location,
bool shared) bool shared)
: shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) { : shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) {
LOG_INFO(Service_FS, "Directory %s set as base for ExtSaveData.", mount_point.c_str()); LOG_DEBUG(Service_FS, "Directory %s set as base for ExtSaveData.", mount_point.c_str());
} }
bool ArchiveFactory_ExtSaveData::Initialize() { bool ArchiveFactory_ExtSaveData::Initialize() {

View file

@ -306,7 +306,7 @@ u64 SDMCArchive::GetFreeBytes() const {
ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory) ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory)
: sdmc_directory(sdmc_directory) { : sdmc_directory(sdmc_directory) {
LOG_INFO(Service_FS, "Directory %s set as SDMC.", sdmc_directory.c_str()); LOG_DEBUG(Service_FS, "Directory %s set as SDMC.", sdmc_directory.c_str());
} }
bool ArchiveFactory_SDMC::Initialize() { bool ArchiveFactory_SDMC::Initialize() {

View file

@ -32,7 +32,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory
ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point) ArchiveFactory_SDMCWriteOnly::ArchiveFactory_SDMCWriteOnly(const std::string& mount_point)
: sdmc_directory(mount_point) { : sdmc_directory(mount_point) {
LOG_INFO(Service_FS, "Directory %s set as SDMCWriteOnly.", sdmc_directory.c_str()); LOG_DEBUG(Service_FS, "Directory %s set as SDMCWriteOnly.", sdmc_directory.c_str());
} }
bool ArchiveFactory_SDMCWriteOnly::Initialize() { bool ArchiveFactory_SDMCWriteOnly::Initialize() {

View file

@ -39,7 +39,7 @@ std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 progr
ArchiveSource_SDSaveData::ArchiveSource_SDSaveData(const std::string& sdmc_directory) ArchiveSource_SDSaveData::ArchiveSource_SDSaveData(const std::string& sdmc_directory)
: mount_point(GetSaveDataContainerPath(sdmc_directory)) { : mount_point(GetSaveDataContainerPath(sdmc_directory)) {
LOG_INFO(Service_FS, "Directory %s set as SaveData.", mount_point.c_str()); LOG_DEBUG(Service_FS, "Directory %s set as SaveData.", mount_point.c_str());
} }
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 program_id) { ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveSource_SDSaveData::Open(u64 program_id) {

View file

@ -139,7 +139,7 @@ std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
type = filename_type; type = filename_type;
} }
LOG_INFO(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type)); LOG_DEBUG(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type));
return GetFileLoader(std::move(file), type, filename_filename, filename); return GetFileLoader(std::move(file), type, filename_filename, filename);
} }

View file

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <cinttypes>
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#include "common/logging/log.h" #include "common/logging/log.h"
@ -253,7 +254,7 @@ ResultStatus AppLoader_NCCH::LoadExeFS() {
// Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)... // Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)...
if (MakeMagic('N', 'C', 'S', 'D') == ncch_header.magic) { if (MakeMagic('N', 'C', 'S', 'D') == ncch_header.magic) {
LOG_WARNING(Loader, "Only loading the first (bootable) NCCH within the NCSD file!"); LOG_DEBUG(Loader, "Only loading the first (bootable) NCCH within the NCSD file!");
ncch_offset = 0x4000; ncch_offset = 0x4000;
file.Seek(ncch_offset, SEEK_SET); file.Seek(ncch_offset, SEEK_SET);
file.ReadBytes(&ncch_header, sizeof(NCCH_Header)); file.ReadBytes(&ncch_header, sizeof(NCCH_Header));
@ -277,8 +278,8 @@ ResultStatus AppLoader_NCCH::LoadExeFS() {
priority = exheader_header.arm11_system_local_caps.priority; priority = exheader_header.arm11_system_local_caps.priority;
resource_limit_category = exheader_header.arm11_system_local_caps.resource_limit_category; resource_limit_category = exheader_header.arm11_system_local_caps.resource_limit_category;
LOG_INFO(Loader, "Name: %s", exheader_header.codeset_info.name); LOG_DEBUG(Loader, "Name: %s", exheader_header.codeset_info.name);
LOG_INFO(Loader, "Program ID: %016llX", ncch_header.program_id); LOG_DEBUG(Loader, "Program ID: %016" PRIX64, ncch_header.program_id);
LOG_DEBUG(Loader, "Code compressed: %s", is_compressed ? "yes" : "no"); LOG_DEBUG(Loader, "Code compressed: %s", is_compressed ? "yes" : "no");
LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point); LOG_DEBUG(Loader, "Entry point: 0x%08X", entry_point);
LOG_DEBUG(Loader, "Code size: 0x%08X", code_size); LOG_DEBUG(Loader, "Code size: 0x%08X", code_size);
@ -336,6 +337,8 @@ ResultStatus AppLoader_NCCH::Load() {
if (result != ResultStatus::Success) if (result != ResultStatus::Success)
return result; return result;
LOG_INFO(Loader, "Program ID: %016" PRIX64, ncch_header.program_id);
is_loaded = true; // Set state to loaded is_loaded = true; // Set state to loaded
result = LoadExec(); // Load the executable into memory for booting result = LoadExec(); // Load the executable into memory for booting