pairs of name (string) and value
import std.stdio : File, stderr; import vibe.data.json : Json, parseJsonString; auto logFile = File.tmpfile(); setLogFile(logFile); scope (exit) setLogFile(stderr); logJsonError("error", "mysterious observation", "secret", 42); logFile.rewind(); auto observed = parseJsonString(logFile.readln); assert(observed["thread"].type == Json.Type.int_); assert(observed["timestamp"].type == Json.Type.int_); assert(observed["error"] == "mysterious observation"); assert(observed["secret"] == 42);
Logs a message in JSON format. If the name part is null the field will not be included into the Json.