std.logger

String logging facilities for Phobos.

Docu:
http://burner.github.io/phobos/phobos-prerelease/std_logger_core.html
http://burner.github.io/phobos/phobos-prerelease/std_logger_stdiologger.html
http://burner.github.io/phobos/phobos-prerelease/std_logger_filelogger.html
http://burner.github.io/phobos/phobos-prerelease/std_logger_multilogger.html
http://burner.github.io/phobos/phobos-prerelease/std_logger_nulllogger.html
http://burner.github.io/phobos/phobos-prerelease/std_logger_templatelogger.html

dub
http://code.dlang.org/packages/logger
You can use documented unittests to test your example code.