From ae27dc2bc87f965860b9b2b088d7dcc341f89d6a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 15 Oct 2023 14:48:28 +0100 Subject: [PATCH] Keymapper: Reduce log spam in verbose mode If a key is not bound, do not log "no name found for key". --- Source/options.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/options.cpp b/Source/options.cpp index 1bcee4c09..5eba80d8d 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -1384,10 +1384,11 @@ void KeymapperOptions::Action::SaveToIni(std::string_view category) const if (boundKey == SDLK_UNKNOWN) { // Just add an empty config entry if the action is unbound. SetIniValue(category.data(), key.data(), ""); + return; } auto keyNameIt = sgOptions.Keymapper.keyIDToKeyName.find(boundKey); if (keyNameIt == sgOptions.Keymapper.keyIDToKeyName.end()) { - LogVerbose("Keymapper: no name found for key '{}'", key); + LogVerbose("Keymapper: no name found for key {} bound to {}", boundKey, key); return; } SetIniValue(category.data(), key.data(), keyNameIt->second.c_str()); @@ -1628,13 +1629,13 @@ void PadmapperOptions::Action::SaveToIni(std::string_view category) const } std::string inputName = sgOptions.Padmapper.buttonToButtonName[static_cast(boundInput.button)]; if (inputName.empty()) { - LogVerbose("Padmapper: no name found for key '{}'", key); + LogVerbose("Padmapper: no name found for button {} bound to {}", static_cast(boundInput.button), key); return; } if (boundInput.modifier != ControllerButton_NONE) { const std::string &modifierName = sgOptions.Padmapper.buttonToButtonName[static_cast(boundInput.modifier)]; if (modifierName.empty()) { - LogVerbose("Padmapper: no name found for key '{}'", key); + LogVerbose("Padmapper: no name found for modifier button {} bound to {}", static_cast(boundInput.button), key); return; } inputName = StrCat(modifierName, "+", inputName);