the example code that's given in the logger documentation no longer works: ```d sharedLog = new FileLogger("New_Default_Log_File.log"); ``` (from https://dlang.org/phobos/std_experimental_logger.html) Error: serverbase/source/served/serverbase.d(595,2): Error: none of the overloads of `sharedLog` are callable using argument types `(FileLogger)` /opt/hostedtoolcache/dc/dmd-2.101.0/x64/dmd2/linux/bin64/../../src/phobos/std/logger/core.d(1456,26): Candidates are: `std.logger.core.sharedLog()` /opt/hostedtoolcache/dc/dmd-2.101.0/x64/dmd2/linux/bin64/../../src/phobos/std/logger/core.d(1471,16): `std.logger.core.sharedLog(shared(Logger) logger)` this has only started happening with DMD 2.101.0 now Trying to use `new shared FileLogger()` also doesn't work, so I'm not sure how to fix this issue from user code, as it looks like assigning a shared Logger is the more correct thing to do here.
Once the 2.101.0 docs are live, the example in question will be found at https://dlang.org/phobos/std_logger.html instead.
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.
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.
Atila has a PR for this, needs rebasing. https://github.com/dlang/phobos/pull/8783.
@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
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
dlang/phobos pull request #9086 "Merge stable" was merged into master: - 4b61e7dd55200372a3b7e9159a52e378b3ee0e3c by Bastiaan Veelo: Fix sharedLog assignment. (#8995) * Allow `new shared FileLogger()` * Address review comment * Update documentation. Fix Bugzilla 23487 - std.experimental.logger assigning FileLogger to sharedLog no longer works * Comment on `trusted` section. --------- Co-authored-by: Atila Neves <atila.neves@gmail.com> https://github.com/dlang/phobos/pull/9086