nreco / logging

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

How to write files of different log levels to different files. #67

Closed bxjg1987 closed 2 months ago

bxjg1987 commented 2 months ago

For example: Debug Write to :debug0. log, debug1. log Error Write to: error 0. log, error 1. log How should I write appsettings Also, this library is simpler than nlog serilog and I really like it! Thank you to the author.

VitaliyMF commented 2 months ago

You can add multiple file loggers and each of them can have its own configuration - not only filename but also FilterLogEntry handler (see FileLoggerOptions). In particular, this handler can check LogMessage.LogLevel and it this way write only, say, Debug entries into concrete log file.

bxjg1987 commented 2 months ago

This is great. Thanks again!