digitalmars.D - Bug in logger
- Prudence (6/6) Sep 03 2015 \..\..\src\phobos\std\experimental\logger\core.d(1784): Error:
- Mike Parker (5/11) Sep 03 2015 The error tells you you're trying to use something in a
- Prudence (4/16) Sep 04 2015 Wait, that makes no sense... The error is in phobos... not my
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (17/34) Sep 04 2015 Is the above the _entire_ error message? For a simple test
- Robert burner Schadek (7/7) Sep 04 2015 the sharedLog Logger (aka default logger) will only work after
- Steven Schveighoffer (4/6) Sep 04 2015 D shouldn't have a problem with this. It uses import dependencies to
\..\..\src\phobos\std\experimental\logger\core.d(1784): Error: static variable stdLoggerThreadLogger cannot be read at compile time I'm trying to use the logger in a static this. It should work or, if it can't, quietly fail(not log anything)... and not break the program.
Sep 03 2015
On Thursday, 3 September 2015 at 23:09:18 UTC, Prudence wrote:\..\..\src\phobos\std\experimental\logger\core.d(1784): Error: static variable stdLoggerThreadLogger cannot be read at compile time I'm trying to use the logger in a static this. It should work or, if it can't, quietly fail(not log anything)... and not break the program.The error tells you you're trying to use something in a compile-time context that can't be used at compile time. You *should* get errors in that situation. Can you share the offending code?
Sep 03 2015
On Friday, 4 September 2015 at 01:00:24 UTC, Mike Parker wrote:On Thursday, 3 September 2015 at 23:09:18 UTC, Prudence wrote:Wait, that makes no sense... The error is in phobos... not my code. THAT specifically means that it is a phobos problem, irrespective of what I'm doing.\..\..\src\phobos\std\experimental\logger\core.d(1784): Error: static variable stdLoggerThreadLogger cannot be read at compile time I'm trying to use the logger in a static this. It should work or, if it can't, quietly fail(not log anything)... and not break the program.The error tells you you're trying to use something in a compile-time context that can't be used at compile time. You *should* get errors in that situation. Can you share the offending code?
Sep 04 2015
On Friday, 4 September 2015 at 17:46:11 UTC, Prudence wrote:On Friday, 4 September 2015 at 01:00:24 UTC, Mike Parker wrote:Is the above the _entire_ error message? For a simple test program, I get the following: int sayHello() { import std.stdio; writeln("Hello!"); return 42; } enum value = sayHello(); // line 7 /home/marc/d/phobos/std/stdio.d(3012): Error: static variable stdout cannot be read at compile time /home/marc/d/phobos/std/stdio.d(3076): called from here: trustedStdout() xx.d(3): called from here: writeln("Hello!") xx.d(7): called from here: sayHello() Notice the lines saying "called from here". They will point you to the place where the compile-time evaluation is started.On Thursday, 3 September 2015 at 23:09:18 UTC, Prudence wrote:Wait, that makes no sense... The error is in phobos... not my code. THAT specifically means that it is a phobos problem, irrespective of what I'm doing.\..\..\src\phobos\std\experimental\logger\core.d(1784): Error: static variable stdLoggerThreadLogger cannot be read at compile time I'm trying to use the logger in a static this. It should work or, if it can't, quietly fail(not log anything)... and not break the program.The error tells you you're trying to use something in a compile-time context that can't be used at compile time. You *should* get errors in that situation. Can you share the offending code?
Sep 04 2015
the sharedLog Logger (aka default logger) will only work after its static this has run. you could create a new Logger and use this one. static this() { auto tmpLog = new FileLogger("logfile.log"); tmpLog.log("Hello World"); }
Sep 04 2015
On 9/4/15 4:30 AM, Robert burner Schadek wrote:the sharedLog Logger (aka default logger) will only work after its static this has run.D shouldn't have a problem with this. It uses import dependencies to make sure the static ctors are run in dependency order. -Steve
Sep 04 2015