Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: logs - unified format and --log-format option #5700

Merged
merged 17 commits into from
Feb 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
server : skip GH copilot requests from logging
  • Loading branch information
ggerganov committed Feb 24, 2024
commit 65e65fd6c0d8c2fbafd3ecfa42ab8c72fb576496
32 changes: 20 additions & 12 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2605,19 +2605,27 @@ static json format_detokenized_response(std::string content)

static void log_server_request(const httplib::Request &req, const httplib::Response &res)
{
LOG_INFO("request", {
{"remote_addr", req.remote_addr},
{"remote_port", req.remote_port},
{"status", res.status},
{"method", req.method},
{"path", req.path},
{"params", req.params},
});
// skip GH copilot requests when using default port
if (req.path == "/v1/health" || req.path == "/v1/completions")
phymbert marked this conversation as resolved.
Show resolved Hide resolved
{
return;
}

LOG_INFO("request",
{
{"remote_addr", req.remote_addr},
{"remote_port", req.remote_port},
{"status", res.status},
{"method", req.method},
{"path", req.path},
{"params", req.params},
});

LOG_VERBOSE("request", {
{"request", req.body},
{"response", res.body},
});
LOG_VERBOSE("request",
{
{"request", req.body},
{"response", res.body},
});
}

struct token_translator
Expand Down