On 3/3/12 5:51 AM, Sönke Ludwig wrote:
Am 17.02.2012 21:48, schrieb Andrei Alexandrescu:
On 2/17/12 12:06 PM, Jose Armando Garcia wrote:
info("%s message", Severity.info);

I think defaulting to formatted stuff may be confusing.

Andrei

Do you often log static messages? In my experience the majority of
logging calls contains dynamic information and using a format string is
the most convenient and readable form (compared to concatenating using
multiple arguments).

An additional infof(), warnf() etc. would be an acceptable alternative,
although not very pretty. But if you'd always have to write
info.format() or something similar, then this would be a real turn-off,
at least for me.

I think it's fine to default to formatted. Also, it just occurred to me that we can adjust the formatting primitives to leave any "%"s alone if there are no matching arguments. Consider:

log.info("100% done!");

This is technically an error, but since D has static knowledge there are no variadics, it could simply output the string. That's faster, too, because no validation of the string is necessary.

Thoughts?


Andrei

Reply via email to