std.logger

evilrat evilrat666 at gmail.com
Thu Aug 22 10:13:17 PDT 2013


On Thursday, 22 August 2013 at 16:16:37 UTC, Jacob Carlborg wrote:
> On 2013-08-22 18:01, develop32 wrote:
>
>> Why logging functions accept only a string? I would expect it 
>> to behave
>> as std.stdio with its variadic parameters.
>>
>> It would be more straightforward to write logging code:
>>
>> log("Moving ", data, " to ", destination);
>>
>> Where 'data' and 'destination' are any variables. I use such 
>> setup in my
>> projects and it helps greatly to identify what went wrong when 
>> not using
>> a debugger.
>
> Good point, and formatted output as well:
>
> logf("Moving % to %", data, destination);

maybe it is bad idea, but string.format can be used too.

log(format("Moving %s to %s", data, destination);


More information about the Digitalmars-d mailing list