How to create a function that behaves like std.stdio.writeln but prepends output with __FILE__:_LINE_

JG someone at somewhere.com
Tue Jan 25 13:18:50 UTC 2022


On Tuesday, 25 January 2022 at 12:27:16 UTC, Dennis wrote:
> On Tuesday, 25 January 2022 at 12:11:01 UTC, JG wrote:
>> Any ideas how one can achieve what is written in the subject 
>> line?
>
> ```D
> void f(T...)(auto ref T args, string file = __FILE__, int line 
> = __LINE__)
> {
>     writeln(file, ":", line, ": ", args);
> }
> ```

Thank you very much.


More information about the Digitalmars-d-learn mailing list