Analyze debug condition in template

Steven Schveighoffer schveiguy at
Tue Oct 26 15:53:54 UTC 2021

On 10/26/21 11:39 AM, novice2 wrote:
> On Tuesday, 26 October 2021 at 09:44:42 UTC, Kagamin wrote:
>> `debug(func1)writefln(...)`
>> But specify a global debug version for the compiler:
>> `dmd -debug=func1 app.d`
> i want to eliminate "debug(func1)"
> i want to be able on/off debugging for one function or another,
> and logf() template should "understand", those on/off for caller

mixin("debug(" ~ func ~ ") doRealThing();");

Now, you just have to actually log in `doRealThing` (a local function) 
or wrap however you want.

Note that setting debug versions doesn't get seen in imported modules, 
only ones specified on the command line will be seen inside your logger.


More information about the Digitalmars-d-learn mailing list