DWT2 Phobos-compatible logging suggestion

torhu no at spam.invalid
Wed Jul 14 08:30:46 PDT 2010


On 13.07.2010 23:46, Jeremy Powers wrote:
> Looks reasonable to me.  Some comments:
>
> I see a danger w/ having the whole class version()'ed around - the
> methods are defined twice, and need to be kept in sync.  Would it be
> better to just do the version around the implementations?  I.E.
> something like:
>
>    class DWTLogger {
>      version(Tango) {
>        tango.util.log.Log.Logger logger;
>      }
>      ...
>      void info(T...)(String file, ulong line, String fmt, T args){
>        version(Tango) {
>          ...
>        } else {
>          ...
>        }
>      }

Yes, you are right. I've done it that way now.

>
> Also, should the tags for the different levels match log4j style?
> That is, use 'INFO', 'DEBUG', etc....

You mean the prefixes printed in the Phobos version?  They're probably 
shortened to three letters to make the start of the content of each line 
align.  I think it's ok the way it is.


>
> Aside:  I was hoping there would be a D-standard logging solution
> similar to log4j, but haven't found one outside of Tango yet - not
> sure how important logging is to DWT itself, but this is definitely
> something needed for many projects.  If such a thing did exist, we
> could just delegate to it (or use directly).

The loggging in DWT is just for debugging, it doesn't need to be very 
flexible.  If Phobos gets a logging package (it has been discussed), we 
can hook into that like we do with Tango.

>
> One more:
>
>>  4) ExceptionPrintStackTrace has become less flexible, but this shouldn't
>>  matter and can easily be fixed if needed.
>
> I've been mucking around with the way exceptions are defined, to allow
> Java-translated code to work with less changes, so assuming I actually
> get that done and it works the ExceptionPrintStackTrace method should
> be unneeded - in favor of just doing e.printStackTrace().  Anyway,
> when I get that part finished I'll send something to the list.

That'd be nice.  I don't know if the Phobos stack tracing can be used 
like that, though.

>
> I'm actually a big fan of code reviews as a form of collaboration - do
> you want to use the list as a place for this kind of thing, or does it
> make sense to do something more formal w/ issue tracking etc?

Thing like a list of which snippets work and which don't would make 
sense to have on a wiki, I suppose.  Maybe tied to a ticket.


More information about the Digitalmars-d-dwt mailing list