On Thursday, 19 November 2015 at 06:27:58 UTC, Andre wrote:
override void writeLogMsg(ref LogEntry payload)
{
with (payload)
{
_stdOutLogger.logf(logLevel, `{
"file":"%s", "line":%s, "funcName":"%s",
"prettyFuncName":"%s",
"moduleName":"%s", "logLevel":%s, "threadId":%s,
"timestamp":"%s", "msg":"%s"}`,
file, line, funcName, prettyFuncName, moduleName, logLevel,
threadId, timestamp);
}
}
I changed the implementation of writeLogMsg and attached the
trusted attribute.
Is this a valid solution?
override void writeLogMsg(ref LogEntry payload) @trusted
{
with (payload)
{
writefln(`{"file":"%s", "line":%s, "funcName":"%s",
"prettyFuncName":"%s",`~
` "moduleName":"%s", "logLevel":%s, "threadId":%s,
"timestamp":"%s", "msg":"%s"}`,
file, line, funcName, prettyFuncName, moduleName, logLevel,
threadId, timestamp, msg);
stdout.flush();
}
}