Log API requests and responses to a file
This commit is contained in:
parent
4c6d3a5f30
commit
6c745dc60c
|
@ -49,6 +49,15 @@ void onAPIRequest(HTTPServerRequest request, HTTPServerResponse response)
|
||||||
|
|
||||||
import std.stdio : writeln;
|
import std.stdio : writeln;
|
||||||
writeln(apiEndpoint);
|
writeln(apiEndpoint);
|
||||||
|
|
||||||
|
import std.file : append;
|
||||||
|
struct LogEntry
|
||||||
|
{
|
||||||
|
string endpoint;
|
||||||
|
Json request;
|
||||||
|
Json response;
|
||||||
|
}
|
||||||
|
append("api.log", LogEntry(apiEndpoint, requestJson, finalResponseJson).serializeToJson.toPrettyString ~ "\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Json getRequestJson(ubyte[] input, string endpoint, string nonce)
|
Json getRequestJson(ubyte[] input, string endpoint, string nonce)
|
||||||
|
|
Loading…
Reference in New Issue