use fmt properly in beammp_*f logging functions

This commit is contained in:
Lion Kortlepel
2022-03-24 14:45:53 +01:00
parent 9e0d02c6db
commit 7a814ed35e
7 changed files with 20 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ void ArgsParser::Parse(const std::vector<std::string_view>& ArgList) {
ConsumeLongFlag(std::string(Arg));
}
} else {
beammp_error("Error parsing commandline arguments: Supplied argument '" + std::string(Arg) + "' is not a valid argument and was ignored.");
beammp_errorf("Error parsing commandline arguments: Supplied argument '{}' is not a valid argument and was ignored.", Arg);
}
}
}
@@ -21,7 +21,7 @@ bool ArgsParser::Verify() {
bool Ok = true;
for (const auto& RegisteredArg : mRegisteredArguments) {
if (RegisteredArg.Flags & Flags::REQUIRED && !FoundArgument(RegisteredArg.Names)) {
beammp_error("Error in commandline arguments: Argument '" + std::string(RegisteredArg.Names.at(0)) + "' is required but wasn't found.");
beammp_errorf("Error in commandline arguments: Argument '{}' is required but wasn't found.", RegisteredArg.Names.at(0));
Ok = false;
continue;
} else if (FoundArgument(RegisteredArg.Names)) {

View File

@@ -160,7 +160,7 @@ bool TConsole::EnsureArgsCount(const std::vector<std::string>& args, size_t min,
return true;
}
void TConsole::Command_Lua(const std::string& cmd, const std::vector<std::string>& args) {
void TConsole::Command_Lua(const std::string&, const std::vector<std::string>& args) {
if (!EnsureArgsCount(args, 0, 1)) {
return;
}
@@ -203,7 +203,7 @@ std::string TConsole::ConcatArgs(const std::vector<std::string>& args, char spac
return Result;
}
void TConsole::Command_Kick(const std::string& cmd, const std::vector<std::string>& args) {
void TConsole::Command_Kick(const std::string&, const std::vector<std::string>& args) {
if (!EnsureArgsCount(args, 1, size_t(-1))) {
return;
}
@@ -290,7 +290,7 @@ std::tuple<std::string, std::vector<std::string>> TConsole::ParseCommand(const s
return { Command, Args };
}
void TConsole::Command_Settings(const std::string& cmd, const std::vector<std::string>& args) {
void TConsole::Command_Settings(const std::string&, const std::vector<std::string>& args) {
if (!EnsureArgsCount(args, 0)) {
return;
}
@@ -573,12 +573,12 @@ TConsole::TConsole() {
beammp_error("Console died with: " + std::string(e.what()) + ". This could be a fatal error and could cause the server to terminate.");
}
};
mCommandline.on_autocomplete = [this](Commandline& c, std::string stub, int) {
mCommandline.on_autocomplete = [this](Commandline&, std::string stub, int) {
std::vector<std::string> suggestions;
try {
auto cmd = TrimString(stub);
//beammp_error("yes 1");
//beammp_error(stub);
// beammp_error("yes 1");
// beammp_error(stub);
if (mIsLuaConsole) { // if lua
if (!mLuaEngine) {
beammp_info("Lua not started yet, please try again in a second");
@@ -596,7 +596,7 @@ TConsole::TConsole() {
std::string::size_type n = key.find(stub);
if (n == 0) {
suggestions.push_back(prefix + key);
//beammp_warn(cmd_name);
// beammp_warn(cmd_name);
}
}
}
@@ -605,7 +605,7 @@ TConsole::TConsole() {
std::string::size_type n = cmd_name.find(stub);
if (n == 0) {
suggestions.push_back(cmd_name);
//beammp_warn(cmd_name);
// beammp_warn(cmd_name);
}
}
}

View File

@@ -116,7 +116,7 @@ void TNetwork::TCPServerMain() {
SOCKET Listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (Listener == BEAMMP_INVALID_SOCKET) {
beammp_error("Failed to create socket: " + GetPlatformAgnosticErrorString()
+ ". This is a fatal error, as a socket is needed for the server to operate. Shutting down.");
+ ". This is a fatal error, as a socket is needed for the server to operate. Shutting down.");
Application::GracefullyShutdown();
}
#if defined(BEAMMP_WINDOWS)

View File

@@ -113,7 +113,7 @@ int BeamMPServerMain(MainArguments Arguments) {
try {
fs::current_path(fs::path(MaybeWorkingDirectory.value()));
} catch (const std::exception& e) {
beammp_error("Could not set working directory to '" + MaybeWorkingDirectory.value() + "': " + e.what());
beammp_errorf("Could not set working directory to '{}': {}", MaybeWorkingDirectory.value(), e.what());
}
}
}