|Posted by Ali Çehreli|
in reply to Krzysztof Jajeśnica
Posted in reply to Krzysztof Jajeśnica
On 1/26/23 12:08, Krzysztof Jajeśnica wrote:
> On Thursday, 26 January 2023 at 17:17:28 UTC, o3o wrote:
>> how can I enable `trace` level?
> Set `sharedLog.logLevel` instead of `globalLogLevel`.
Good catch. I had tried the following without success:
stdThreadLocalLog.logLevel = LogLevel.all;
> // Note: the cast is needed because sharedLog is shared
> (cast()sharedLog).logLevel = LogLevel.all;
I did not think casting that way would be the right thing to do.
Although I've never used std.logger, and without remembering who implemented it (sincere aplogies), given how simple the use cases of logging are, I found its implementation very complicated. For example, the following function is one I stumbled upon while debugging the OP's issue:
bool isLoggingEnabled()(LogLevel ll, LogLevel loggerLL,
LogLevel globalLL, lazy bool condition = true) @safe
return ll >= globalLL
&& ll >= loggerLL
&& ll != LogLevel.off
&& globalLL != LogLevel.off
&& loggerLL != LogLevel.off
I don't think it is possible to entagle usage issues with functions with that semantic complexity.