Strip trailing newline from timestamp
This commit is contained in:
parent
e657640409
commit
1c8287d80f
@ -144,9 +144,18 @@ static std::string method_to_string(webcxx::RequestType method) {
|
||||
}
|
||||
}
|
||||
|
||||
static std::string remove_trailing_newline(std::string str)
|
||||
{
|
||||
while(str[str.size() - 1] == '\n')
|
||||
{
|
||||
str.pop_back();
|
||||
}
|
||||
return std::move(str);
|
||||
}
|
||||
|
||||
void webcxx::Request::log(int status_code) {
|
||||
time_t current_time = time(NULL);
|
||||
printf("(%s) %s - \"%s %s HTTP/1.1\" - %d\n", ctime(¤t_time), m_ip.c_str(),
|
||||
printf("(%s) %s - \"%s %s HTTP/1.1\" - %d\n", remove_trailing_newline(ctime(¤t_time)).c_str(), m_ip.c_str(),
|
||||
method_to_string(m_method).c_str(),
|
||||
m_real_path.c_str(),
|
||||
status_code);
|
||||
|
Loading…
Reference in New Issue
Block a user