std.experimental.logger

Mike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 4 18:49:01 PST 2016


On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote:
> I'm doing the following:
>
> import std.experimental.logger;
>
> int
> main(string[] args)
> {
> sharedLog = new FileLogger("logfile.log");
>
> log("Test log 1");
> log("Test log 2");
> log("Test log 3");
> }
>
>
> and I expected the logs to be seen in the logfile.log, but it 
> seems like my reading of the docs on this is incorrect and the 
> logfile.log is not populated at all (though it is created). 
> What am I missing or using incorrectly?
>
> Basically I am trying to have the default logger log to a file 
> instead of stderr.
>
> (I am on a Mac (OS-X 10.11.1, 64 bit) and using DMD 2.069.2)

You need to log with sharedLog:
sharedLog.log("Test log 1");
sharedLog.log("Test log 2");
sharedLog.log("Test log 3");



More information about the Digitalmars-d-learn mailing list