service/cfg: Migrate logging macros (#3853)

* service/cfg: Migrate logging macros

* service/cfg: Fix clang format

* service/cfg: Addressed comment about char cast

* service/cfg: Changed to static_cast<char>
This commit is contained in:
NarcolepticK 2018-06-22 04:46:22 -04:00 committed by Weiyi Wang
parent 4c67f1c7c6
commit 2d94c25265
1 changed files with 13 additions and 13 deletions

View File

@ -131,7 +131,7 @@ void Module::Interface::GetCountryCodeString(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) {
LOG_ERROR(Service_CFG, "requested country code id=%d is invalid", country_code_id);
NGLOG_ERROR(Service_CFG, "requested country code id={} is invalid", country_code_id);
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
rb.Skip(1, false);
@ -160,8 +160,8 @@ void Module::Interface::GetCountryCodeID(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
if (0 == country_code_id) {
LOG_ERROR(Service_CFG, "requested country code name=%c%c is invalid", country_code & 0xff,
country_code >> 8);
NGLOG_ERROR(Service_CFG, "requested country code name={}{} is invalid",
static_cast<char>(country_code & 0xff), static_cast<char>(country_code >> 8));
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent));
rb.Push<u16>(0x00FF);
@ -210,7 +210,7 @@ void Module::Interface::GenHashConsoleUnique(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0);
}
LOG_DEBUG(Service_CFG, "called app_id_salt=0x%X", app_id_salt);
NGLOG_DEBUG(Service_CFG, "called app_id_salt=0x{:X}", app_id_salt);
}
void Module::Interface::GetRegionCanadaUSA(Kernel::HLERequestContext& ctx) {
@ -309,22 +309,22 @@ ResultVal<void*> Module::GetConfigInfoBlockPointer(u32 block_id, u32 size, u32 f
[&](const SaveConfigBlockEntry& entry) { return entry.block_id == block_id; });
if (itr == std::end(config->block_entries)) {
LOG_ERROR(Service_CFG, "Config block 0x%X with flags %u and size %u was not found",
block_id, flag, size);
NGLOG_ERROR(Service_CFG, "Config block 0x{:X} with flags {} and size {} was not found",
block_id, flag, size);
return ResultCode(ErrorDescription::NotFound, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
if ((itr->flags & flag) == 0) {
LOG_ERROR(Service_CFG, "Invalid flag %u for config block 0x%X with size %u", flag, block_id,
size);
NGLOG_ERROR(Service_CFG, "Invalid flag {} for config block 0x{:X} with size {}", flag,
block_id, size);
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
if (itr->size != size) {
LOG_ERROR(Service_CFG, "Invalid size %u for config block 0x%X with flags %u", size,
block_id, flag);
NGLOG_ERROR(Service_CFG, "Invalid size {} for config block 0x{:X} with flags {}", size,
block_id, flag);
return ResultCode(ErrorDescription::InvalidSize, ErrorModule::Config,
ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
@ -599,15 +599,15 @@ static SystemLanguage AdjustLanguageInfoBlock(u32 region, SystemLanguage languag
void Module::SetPreferredRegionCode(u32 region_code) {
preferred_region_code = region_code;
LOG_INFO(Service_CFG, "Preferred region code set to %u", preferred_region_code);
NGLOG_INFO(Service_CFG, "Preferred region code set to {}", preferred_region_code);
if (Settings::values.region_value == Settings::REGION_VALUE_AUTO_SELECT) {
const SystemLanguage current_language = GetSystemLanguage();
const SystemLanguage adjusted_language =
AdjustLanguageInfoBlock(region_code, current_language);
if (current_language != adjusted_language) {
LOG_WARNING(Service_CFG, "System language %d does not fit the region. Adjusted to %d",
static_cast<int>(current_language), static_cast<int>(adjusted_language));
NGLOG_WARNING(Service_CFG, "System language {} does not fit the region. Adjusted to {}",
static_cast<int>(current_language), static_cast<int>(adjusted_language));
SetSystemLanguage(adjusted_language);
}
}