Thread overview
[Issue 23487] std.experimental.logger assigning FileLogger to sharedLog no longer works
May 31
Forest
Jul 20
Dlang Bot
Jul 21
Dlang Bot
November 15, 2022
https://issues.dlang.org/show_bug.cgi?id=23487

elpenguino+D@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |elpenguino+D@gmail.com

--- Comment #1 from elpenguino+D@gmail.com ---
Once the 2.101.0 docs are live, the example in question will be found at https://dlang.org/phobos/std_logger.html instead.

--
May 31
https://issues.dlang.org/show_bug.cgi?id=23487

Forest <forestix@nom.one> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |forestix@nom.one

--- Comment #2 from Forest <forestix@nom.one> ---
The 2.108.1 are live, and the example at that URL still doesn't work.

This seems to do the trick:

sharedLog = cast(shared(Logger)) new FileLogger("foo.log");

Is this now considered the correct way to do it?

It would be nice if awkward casts like this were not imposed on the user.

--
July 05
https://issues.dlang.org/show_bug.cgi?id=23487

Bastiaan Veelo <Bastiaan@Veelo.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Bastiaan@Veelo.net

--- Comment #3 from Bastiaan Veelo <Bastiaan@Veelo.net> ---
There is a PR to adjust the documentation for this (https://github.com/dlang/phobos/pull/8995) but, as Nicholas Wilson points out, the correct syntax would be

```d
sharedLog = new shared(FileLogger)(yourFile);
```

This does not work since there is currently no shared constructor. I have tried to implement one in https://github.com/dlang/phobos/pull/8996, but that's way harder than I expected. I hope somebody smarter than me will be able to, because the difficulty of it suggests to me that just casting to shared is not a good solution.

--
July 05
https://issues.dlang.org/show_bug.cgi?id=23487

--- Comment #4 from Bastiaan Veelo <Bastiaan@Veelo.net> ---
Atila has a PR for this, needs rebasing. https://github.com/dlang/phobos/pull/8783.

--
July 20
https://issues.dlang.org/show_bug.cgi?id=23487

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@veelo updated dlang/phobos pull request #8995 "Correct documentation." fixing this issue:

- Update documentation.

  Fix Bugzilla 23487 - std.experimental.logger assigning FileLogger to
sharedLog no longer works

https://github.com/dlang/phobos/pull/8995

--
July 21
https://issues.dlang.org/show_bug.cgi?id=23487

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #8995 "Fix sharedLog assignment." was merged into stable:

- df00b0816bbaa0d076a0b5581b182a1f7ee74a40 by Bastiaan Veelo:
  Update documentation.

  Fix Bugzilla 23487 - std.experimental.logger assigning FileLogger to
sharedLog no longer works

https://github.com/dlang/phobos/pull/8995

--