Mercurial > hg > piper-cpp
diff vamp-server/server.cpp @ 103:6fad5154778e
Add pid to server debug output
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 14 Oct 2016 16:23:36 +0100 |
parents | 427c4c725085 |
children | 491a4bc10a01 |
line wrap: on
line diff
--- a/vamp-server/server.cpp Fri Oct 14 12:46:38 2016 +0100 +++ b/vamp-server/server.cpp Fri Oct 14 16:23:36 2016 +0100 @@ -13,10 +13,14 @@ #include <map> #include <set> +#include <unistd.h> // getpid for logging + using namespace std; using namespace piper_vamp; using namespace Vamp; +static int pid = getpid(); + void usage() { string myname = "piper-vamp-server"; @@ -175,7 +179,7 @@ response.loadResponse = LoaderRequests().loadPlugin(request.loadRequest); if (response.loadResponse.plugin != nullptr) { mapper.addPlugin(response.loadResponse.plugin); - cerr << "loaded plugin, handle = " << mapper.pluginToHandle(response.loadResponse.plugin) << endl; + cerr << "piper-vamp-server " << pid << ": loaded plugin, handle = " << mapper.pluginToHandle(response.loadResponse.plugin) << endl; response.success = true; } break; @@ -257,7 +261,7 @@ return response; } -int main(int argc, char **argv) +int main(int argc, char **) { if (argc != 1) { usage(); @@ -271,36 +275,36 @@ request = readRequestCapnp(); - cerr << "piper-vamp-server: request received, of type " + cerr << "piper-vamp-server " << pid << ": request received, of type " << int(request.type) << endl; // NotValid without an exception indicates EOF: if (request.type == RRType::NotValid) { - cerr << "piper-vamp-server: eof reached, exiting" << endl; + cerr << "piper-vamp-server " << pid << ": eof reached, exiting" << endl; break; } RequestOrResponse response = handleRequest(request); response.id = request.id; - cerr << "piper-vamp-server: request handled, writing response" + cerr << "piper-vamp-server " << pid << ": request handled, writing response" << endl; writeResponseCapnp(response); - cerr << "piper-vamp-server: response written" << endl; + cerr << "piper-vamp-server " << pid << ": response written" << endl; if (request.type == RRType::Finish) { auto h = mapper.pluginToHandle(request.finishRequest.plugin); - cerr << "deleting the plugin with handle " << h << endl; + cerr << "piper-vamp-server " << pid << ": deleting the plugin with handle " << h << endl; mapper.removePlugin(h); delete request.finishRequest.plugin; } } catch (std::exception &e) { - cerr << "piper-vamp-server: error: " << e.what() << endl; + cerr << "piper-vamp-server " << pid << ": error: " << e.what() << endl; writeExceptionCapnp(e, request.type);