I have a use case where I need to log data to file Asynchronously which I do not see it possible with Microsoft.Extensions.Logging so need your help to figure out the best solution
The wrapped sink (File in this case) will be invoked on a worker thread while your application's thread gets on with more important stuff.
TextWriter.Synchronized
and WriteLineAsync
OR if there is any other solution which I am not aware of
It's normal for logging to use a background thread so it can expose a synchronous logging API. If all logging APIs were asynchronous, then that would force practically every method to be asynchronous.
Logging synchronously to a background thread also enables buffering and batched writes, which increase performance.