> Does your IO layer require one call per log line or can you do multiple 
> writes followed by an "end log line" terminator? 
> Assuming the former, the most obvious approach would be for the writer to 
> have a static array equal to the max log line size,
> accumulate until done and then issue one write to the output layer.

I don't understand, you mean I should pass `args` directly to the
writer? I tried it, ended up with linker errors, since writer is an
interface:

----
interface IWriter {
    void log(LogLevel level, string name, const(char)[] message);
    @property bool bubbles();
    @property void bubbles(bool);
}
----

So I have to pass a string around, which isn't a big deal, until the
runtime shuts down.


jA_cOp pointed me to std.string.sformat on IRC, I tried it with a
stack-allocated buffer, unfortunatly it seems to allocate somewhere:

----
#0  0x00000000015cc4dc in onInvalidMemoryOperationError ()
#1  0x00000000015b53d2 in gc.gcx.GC.mallocNoSync() ()
#2  0x00000000015b534b in gc.gcx.GC.malloc() ()
#3  0x000000000157d569 in gc_malloc ()
#4  0x000000000157fcbb in _d_allocmemory ()
#5  0x00000000008f0f7b in char[] std.string.sformat!(char, void*,
immutable(char)[], uint).sformat(char[], const(char[]), void*,
immutable(char)[], uint)
----

So this is also no solution, since I wasn't able to find the origin of
this allocation (it's not because an error is thrown, well very
unlikely, formatting with the same arguments at "runtime" works)

Reply via email to