AsyncLogger for std.experimental.logger

Max Klimov via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 17 00:32:37 PDT 2015


Is anyone interested in asynchronous implementation of Logger 
from std.experimental.logger right as a part of phobos?
https://github.com/Groterik/phobos/blob/asynclogger/std/experimental/logger/asynclogger.d
I have just created a pull request just in case:
https://github.com/D-Programming-Language/phobos/pull/3194

I realize that usually when people need asynchronous logging, 
they use something like syslog, log4cxx, etc. But thanks to 
std.concurrency and recently added std.experimental.logger, an 
idea appeared to implement light, portable and quite efficient 
"separate logging thread".
This simple benchmark [http://pastebin.com/jSfjL5Zr] is showing 
the following results on my local machine:
1. FileLogger - "1 sec, 896 ms, 881 μs, and 3 hnsecs".
2. AsyncLogger - "120 ms, 967 μs, and 5 hnsecs".
3. syslog - "1 sec, 283 ms, 716 μs, and 8 hnsecs".
It seems like AsyncLogger manages not to freeze caller thread a 
lot.

Any suggestions and reviews will be appreciated.

Thank you,
Max.


More information about the Digitalmars-d mailing list