'How to write log file daily in c#

I'm using a dynamic linked library (DLL) and I want to write log file for the DLL daily. How can I implement this in c#? I'm using serilog to do that but as DLL contains no startup class so it's creating new file every time there is a error message.

What I'm getting: Yesterday: log20220509.txt log20220509_01.txt log20220509_02.txt

Today: log20220510.txt log20220510_01.txt log20220510_02.txt

What I'm looking for: Yesterday: log20220509.txt

Today: log20220510.txt



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source