std.experimental.logger default log level is everything

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Fri May 28 19:43:05 UTC 2021


On Friday, 28 May 2021 at 18:48:56 UTC, Steven Schveighoffer 
wrote:
> On 5/28/21 1:57 PM, SealabJaster wrote:
>> On Friday, 28 May 2021 at 17:29:48 UTC, Steven Schveighoffer 
>> wrote:
>> 
>> I like how it's handled in C#'s Microsoft logging library. 
>> Without some form of being able to distinguish between "log 
>> from app" and "log from library X/Y/Z", std.logger doesn't 
>> seem usable inside of libraries (maybe if the library is a 
>> framework, then you could get away with it possibly).
>> 
>> https://docs.microsoft.com/en-us/dotnet/core/extensions/logging
>
> Unfortunately, std.experimental.logger doesn't seem to have a 
> mechanism to filter logs based on source. I think adding a 
> separate filtering system (I've used similar things like log4j, 
> and written some myself) would be a huge undertaking.
>
> -Steve

You can still implement custom logger, that will allow filtering 
by source,check the documentation: 
https://dlang.org/phobos/std_experimental_logger.html

It indeed might be useful to have a logger configurable by some 
file as a package in dub, and it can actually be integrated with 
existing api. It can either replace main logger or expose a 
custom logger, if necessary.

Best regards,
Alexandru.


More information about the Digitalmars-d mailing list