std.experimental.logger: practical observations

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 11:32:30 PDT 2014


Ah, so you avoid recursion issues by separating the calls to
error() et altera from the actual process of writing to disk
or sending via the network.

Behind error() there would be a fixed implementation
controlled by the author of the logging library that just
appends the payloads to a list.
Another thread would pick items from that list and push them
into our Logger classes where we can happily use the logging
functionalities ourselves, because they would just get
appended to the list and wait for their time instead of
causing an immediate recursive call.

So basically your idea is message passing between the
application and a physical (probably low priority) logging
thread. This should also satisfy those who don't want to wait
for the logging calls to finish while serving web requests.
How do such systems handle a full inbox? In Phobos we have
http://dlang.org/phobos/std_concurrency.html#.OnCrowding

-- 
Marco



More information about the Digitalmars-d mailing list