std.experimental.logger formal review round 3

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 27 15:26:59 PDT 2014


On 10/27/2014 09:28 AM, Robert burner Schadek wrote:
>
> If it where done this way, yes of course you're right. But it is not,
> please take a look a the source first.

I'm looking at 
https://github.com/burner/phobos/blob/logger/std/experimental/logger/core.d 
and this is exactly how this works.

Even if we make isLoggingActive a template, the problem persists.

cat > lib.d << CODE
version (StdLoggerDisableLogging)
     enum isLoggingActive() = false;
else
     enum isLoggingActive() = true;

void doSome()
{
     import std.stdio;
     writeln("loggingLib: ", isLoggingActive!());
}
CODE

cat > main.d << CODE
import lib, std.stdio;

void main()
{
     writeln("loggingMain: ", isLoggingActive!());
     doSome();
}
CODE

dmd -version=StdLoggerDisableLogging -lib lib.d
dmd main lib.a
./main
----
logginMain: true
logginLib: false
----
dmd -lib lib.d
dmd -version=StdLoggerDisableLogging main lib.a
./main
----
logginMain: false
logginLib: true
----


More information about the Digitalmars-d mailing list