nreco / logging

Generic file logger for .NET Core (FileLoggerProvider) with minimal dependencies
MIT License
284 stars 56 forks source link

Would be possible to use LogLevel structure ? #39

Closed JiriZidek closed 2 years ago

JiriZidek commented 2 years ago

It looks like appsettings.json parameter "MinLevel": "Warning", // min level for the file logger replaces normal

    "LogLevel": {
      "Default": "Information",
      "System": "Warning",
      "Microsoft": "Warning"
    }

Am I missing something ? Is tehre any plan to use the microsoftish way of configuring levels ? Thanks for clarification. Jiri

VitaliyMF commented 2 years ago

Am I missing something ? Is tehre any plan to use the microsoftish way of configuring levels ?

Message filtering rules are applied inside logging infrastructure (Microsoft.Extensions.Logging) and works for all logging providers in a same way.

However, you can specify min log level exactly for FileLoggingProvider (say, write to a file only "Warning" and "Error" entries).

JiriZidek commented 2 years ago

So using "MinLevel": "Warning" is in fact very same like setting: { "File": { "LogLevel": { "Default": "Warning" }, ..... } OK, clear now.