std.logger sharedLog usage

lobo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 28 18:36:22 PDT 2015


Hi,

I'm trying to use std.experimental.logger and I'd like the 
logf(), tracef() style functions to log to a file and stdout.
(note: I can use sharedLog.logf(), sharedLog.tracef(), but I 
prefer just logf())


So I did this:

shared static this() {
     auto ml = new MultiLogger();
     ml.insertLogger("stdout", new FileLogger(std.stdio.stdout));
     ml.insertLogger("applog", new FileLogger("applog.txt"));
     sharedLog = ml;
     logf("This is a test"); // Doesn't work
}


Which doesn't work, so I'm wondering if it's possible to do what 
I want.


thanks,
lobo


More information about the Digitalmars-d-learn mailing list