nreco / logging

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

Ability to stack error file handlers #52

Open dkorecko opened 1 year ago

dkorecko commented 1 year ago

Essentially, I would think that if in the HandleFileError I add a string to the file name, then if the initial log file is being used by another process and the alternative file name is also being used by a different process, it would just do something like "FileName_alt_alt.log" instead of just crashing on "FileName_alt".

Thoughts?

VitaliyMF commented 1 year ago

I guess you can perform all necessary checks inside your "HandleFileError" handler to choose an alternate file name that is 100% not used. It is definitely more safe than making "HandleFileError" recursive (in some cases this may lead to infinite recursion which is definitely bad design).