Skip to content

Commit 7514242

Browse files
uifdevAmyrAhmady
andauthored
Fixed: legacy config variable 'chatlogging' does not control death logging (#1057)
* 'chatlogging' also sets 'logging.log_deaths' * fix formatting --------- Co-authored-by: iAmir <[email protected]>
1 parent b4e4e99 commit 7514242

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Server/Components/LegacyConfig/config_main.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const FlatHashMap<StringView, ParamType> types = {
6666
{ "timestamp", ParamType::Bool },
6767
{ "logtimeformat", ParamType::String },
6868
{ "logqueries", ParamType::Bool },
69-
{ "chatlogging", ParamType::Bool },
69+
{ "chatlogging", ParamType::Custom },
7070
{ "db_logging", ParamType::Bool },
7171
{ "db_log_queries", ParamType::Bool },
7272
{ "onfoot_rate", ParamType::Int },
@@ -209,6 +209,30 @@ class LegacyConfigComponent final : public ILegacyConfigComponent, public Consol
209209
return true;
210210
}
211211

212+
if (name.find("chatlogging") == 0)
213+
{
214+
auto it = dictionary.find("chatlogging");
215+
216+
Impl::String lower(right);
217+
std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c)
218+
{
219+
return std::tolower(c);
220+
});
221+
222+
if (lower == "true" || lower == "1")
223+
{
224+
config.setBool(it->second, true);
225+
config.setBool("logging.log_deaths", true);
226+
}
227+
else if (lower == "false" || lower == "0")
228+
{
229+
config.setBool(it->second, false);
230+
config.setBool("logging.log_deaths", false);
231+
}
232+
233+
return true;
234+
}
235+
212236
return false;
213237
}
214238

0 commit comments

Comments
 (0)