www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - AsyncLogger for std.experimental.logger

reply "Max Klimov" <klimroot mail.ru> writes:
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.
Apr 17 2015
parent "Robert burner Schadek" <rburners gmail.com> writes:
I will have a look at it (properly this weekend)
Apr 17 2015