Example code in std.logger.core doesn't even work

WebFreak001 d.forum at webfreak.org
Wed Jul 12 10:29:50 UTC 2023


On Wednesday, 12 July 2023 at 03:00:11 UTC, mw wrote:
> On Monday, 13 March 2023 at 20:32:08 UTC, WebFreak001 wrote:
>> On Monday, 13 March 2023 at 02:53:00 UTC, Yuxuan Shui wrote:
>>> Example here:
>>>
>>> https://dlang.org/phobos/std_logger_core.html#.sharedLog
>>>
>>> Result:
>>>
>>> https://run.dlang.io/is/RMtF0I
>>
>> this changed in one of the most recent releases, but you can 
>> always expect breaking changes in an std.experimental module
>
> Can you please show the correct usage pattern of this 
> sharedLog, in the new release?

what I do now in my code:

```d
static if (__VERSION__ < 2101)
	sharedLog = new FileLogger(io.stderr);
else
	sharedLog = (() @trusted => cast(shared) new 
FileLogger(io.stderr))();
```

not a big fan of the changes and the fact that this got made 
std.logger instead of the previous API, but it works at least


More information about the Digitalmars-d mailing list