mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-19 08:20:10 +01:00
revert log format changes
This commit is contained in:
parent
0f95689c17
commit
e192f950a3
@ -862,23 +862,19 @@ static void parse_options_completion(const json & body, llama_server_context & l
|
|||||||
|
|
||||||
|
|
||||||
static void log_server_request(const Request & req, const Response & res) {
|
static void log_server_request(const Request & req, const Response & res) {
|
||||||
std::string referrer = req.has_header("Referer") ? req.get_header_value("Referer") : "-";
|
LOG_INFO("request", {
|
||||||
std::string user_agent = req.has_header("User-Agent") ? req.get_header_value("User-Agent") : "-";
|
{ "remote_addr", req.remote_addr },
|
||||||
std::time_t now = std::time(nullptr);
|
{ "remote_port", req.remote_port },
|
||||||
char time_str[80];
|
{ "status", res.status },
|
||||||
std::strftime(time_str, sizeof(time_str), "%d/%b/%Y:%H:%M:%S %z", std::localtime(&now));
|
{ "method", req.method },
|
||||||
|
{ "path", req.path },
|
||||||
|
{ "params", req.params },
|
||||||
|
});
|
||||||
|
|
||||||
fprintf(stdout, "%s - - [%s] \"%s %s HTTP/%s\" %d %zu \"%s\" \"%s\"\n",
|
LOG_VERBOSE("request", {
|
||||||
req.remote_addr.c_str(),
|
{ "request", req.body },
|
||||||
time_str,
|
{ "response", res.body },
|
||||||
req.method.c_str(),
|
});
|
||||||
req.path.c_str(),
|
|
||||||
"1.1",
|
|
||||||
res.status,
|
|
||||||
res.body.size(),
|
|
||||||
referrer.c_str(),
|
|
||||||
user_agent.c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
@ -1099,8 +1095,13 @@ int main(int argc, char ** argv) {
|
|||||||
// Set the base directory for serving static files
|
// Set the base directory for serving static files
|
||||||
svr.set_base_dir(sparams.public_path);
|
svr.set_base_dir(sparams.public_path);
|
||||||
|
|
||||||
|
// to make it ctrl+clickable:
|
||||||
fprintf(stdout, "\nllama server listening at http://%s:%d\n\n", sparams.hostname.c_str(), sparams.port);
|
fprintf(stdout, "\nllama server listening at http://%s:%d\n\n", sparams.hostname.c_str(), sparams.port);
|
||||||
|
|
||||||
|
LOG_INFO("HTTP server listening", {
|
||||||
|
{ "hostname", sparams.hostname },
|
||||||
|
{ "port", sparams.port },
|
||||||
|
});
|
||||||
|
|
||||||
if (!svr.listen_after_bind()) {
|
if (!svr.listen_after_bind()) {
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user