diff options
| author | 2018-04-26 22:53:14 -0400 | |
|---|---|---|
| committer | 2018-04-26 22:53:14 -0400 | |
| commit | 18f8012233cda88aacf01c59f89abf3a687ab2c9 (patch) | |
| tree | f1b13d10c366085c1a85e80aeb48dfb6776e01a7 /src/common/param_package.cpp | |
| parent | Merge pull request #405 from lioncash/input (diff) | |
| parent | common: Move logging macros over to new fmt-capable macros where applicable (diff) | |
| download | yuzu-18f8012233cda88aacf01c59f89abf3a687ab2c9.tar.gz yuzu-18f8012233cda88aacf01c59f89abf3a687ab2c9.tar.xz yuzu-18f8012233cda88aacf01c59f89abf3a687ab2c9.zip | |
Merge pull request #407 from lioncash/common
common: Move logging macros over to new fmt-capable macros where applicable
Diffstat (limited to 'src/common/param_package.cpp')
| -rw-r--r-- | src/common/param_package.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/param_package.cpp b/src/common/param_package.cpp index 3a6ef8c27..ab0154133 100644 --- a/src/common/param_package.cpp +++ b/src/common/param_package.cpp | |||
| @@ -25,7 +25,7 @@ ParamPackage::ParamPackage(const std::string& serialized) { | |||
| 25 | std::vector<std::string> key_value; | 25 | std::vector<std::string> key_value; |
| 26 | Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value); | 26 | Common::SplitString(pair, KEY_VALUE_SEPARATOR, key_value); |
| 27 | if (key_value.size() != 2) { | 27 | if (key_value.size() != 2) { |
| 28 | LOG_ERROR(Common, "invalid key pair %s", pair.c_str()); | 28 | NGLOG_ERROR(Common, "invalid key pair {}", pair); |
| 29 | continue; | 29 | continue; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| @@ -64,7 +64,7 @@ std::string ParamPackage::Serialize() const { | |||
| 64 | std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const { | 64 | std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const { |
| 65 | auto pair = data.find(key); | 65 | auto pair = data.find(key); |
| 66 | if (pair == data.end()) { | 66 | if (pair == data.end()) { |
| 67 | LOG_DEBUG(Common, "key %s not found", key.c_str()); | 67 | NGLOG_DEBUG(Common, "key '{}' not found", key); |
| 68 | return default_value; | 68 | return default_value; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -74,14 +74,14 @@ std::string ParamPackage::Get(const std::string& key, const std::string& default | |||
| 74 | int ParamPackage::Get(const std::string& key, int default_value) const { | 74 | int ParamPackage::Get(const std::string& key, int default_value) const { |
| 75 | auto pair = data.find(key); | 75 | auto pair = data.find(key); |
| 76 | if (pair == data.end()) { | 76 | if (pair == data.end()) { |
| 77 | LOG_DEBUG(Common, "key %s not found", key.c_str()); | 77 | NGLOG_DEBUG(Common, "key '{}' not found", key); |
| 78 | return default_value; | 78 | return default_value; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | try { | 81 | try { |
| 82 | return std::stoi(pair->second); | 82 | return std::stoi(pair->second); |
| 83 | } catch (const std::logic_error&) { | 83 | } catch (const std::logic_error&) { |
| 84 | LOG_ERROR(Common, "failed to convert %s to int", pair->second.c_str()); | 84 | NGLOG_ERROR(Common, "failed to convert {} to int", pair->second); |
| 85 | return default_value; | 85 | return default_value; |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| @@ -89,14 +89,14 @@ int ParamPackage::Get(const std::string& key, int default_value) const { | |||
| 89 | float ParamPackage::Get(const std::string& key, float default_value) const { | 89 | float ParamPackage::Get(const std::string& key, float default_value) const { |
| 90 | auto pair = data.find(key); | 90 | auto pair = data.find(key); |
| 91 | if (pair == data.end()) { | 91 | if (pair == data.end()) { |
| 92 | LOG_DEBUG(Common, "key %s not found", key.c_str()); | 92 | NGLOG_DEBUG(Common, "key {} not found", key); |
| 93 | return default_value; | 93 | return default_value; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | try { | 96 | try { |
| 97 | return std::stof(pair->second); | 97 | return std::stof(pair->second); |
| 98 | } catch (const std::logic_error&) { | 98 | } catch (const std::logic_error&) { |
| 99 | LOG_ERROR(Common, "failed to convert %s to float", pair->second.c_str()); | 99 | NGLOG_ERROR(Common, "failed to convert {} to float", pair->second); |
| 100 | return default_value; | 100 | return default_value; |
| 101 | } | 101 | } |
| 102 | } | 102 | } |