std.logger

Robert Schadek realburner at gmx.de
Thu Aug 22 10:13:05 PDT 2013


On 08/22/2013 06:01 PM, 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.
>
I thought about that. IMO this would create very heavy template bloat,
because you would also have to pass __LINE__, __FUNCTION__ as template
arguments.
Whats so wrong with log("%s %s %s %s".format("Moving", "data", "to",
destination)); This way you don't have to remember to place the spaces
left and right.


More information about the Digitalmars-d mailing list