On 2010-07-13 23.00, torhu wrote:
Ok, this is sort my way to get some cooperation going on the DWT
project.  Check it out and make suggestions for improvements, or just
say "ok" if you approve :)

I've been trying for a couple of hours to find a way to do logging
that's compatible with both Phobos and Tango.

Here's what I came up with, this is tested and working:
http://pastebin.ca/1900029

This is what I had to take into consideration:

1) Phobos formatting uses functions like format(...), while tango uses
format(char[] fmt, ...). Using the signature func(T...)(String fmt, T
args) was the simplest way I found to be able to just forward arguments
to both kinds of formatters.

2) Format specifiers are different. I just did fmt = replace(fmt, "{}",
"%s") in the Phobos version, which takes care of most cases. We can
revisit this later if there's an actual need for more flexible formatting.

3) The IDwtLogger interface had to go, as template member functions
cannot be virtual. Cfr. item 1. The interface was not put to use
anywhere, so this should be of no concern.

4) ExceptionPrintStackTrace has become less flexible, but this shouldn't
matter and can easily be fixed if needed.

Seems good, just a question: what is this diff against? Is it to your own branch or to the DWT2 main branch? I don't see a version condition in ExceptionPrintStackTrace in the DWT2 main branch for example.

--
Jacob Carlborg

Reply via email to