add func: getDebugTime

This commit is contained in:
Talyx
2022-02-22 19:49:37 +03:00
parent c7d4ece622
commit 0862f6eb79
2 changed files with 21 additions and 1 deletions

View File

@@ -18,6 +18,25 @@ ServerConfig::ServerConfig(TOMLMap *map)
}
//--------------------------------------------------GET/SET---------------------------------------
std::string getDebugTime(void)
{
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
std::string ret = std::string(asctime(timeinfo));
for (size_t i = 0; i < 3; i++)
{
ret.erase(0, ret.find(" ") + 1);
}
ret.erase(ret.find(" "));
ret = "[ " + ret + " ]";
return (ret);
}
std::string &ServerConfig::getServerName(void)
{
return (_serverName);
@@ -317,7 +336,7 @@ int ServerConfig::putLocation(toml_node *node)
tmp->redirect.insert(std::make_pair(atoi(str.c_str()), *(*it2)->getString()));
}
else
std::cerr << RED << "Warning: unknown parameter: "<< it1->first << ZERO_C << std::endl;
DBOUT << WARNING << getDebugTime() << FAIL << "Warning: unknown parameter: "<< it1->first << ENDL;
}
_locations.push_back(tmp);
it++;

View File

@@ -84,6 +84,7 @@ public:
~ServerConfig();
};
std::string getDebugTime();