I am new to Blazor. I want to log to a file in client side of Blazor WASM. I tried using serilog and serilog.sink.file. But I don't see any logs written to a file. I also don'see any errors. Is it because Blazor WASM operates in the browser sandbox which cannot access local filesystem.Is there any way to log to file from Blazor WASM.
The code I tried for configuring in Main:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Is(logLevel)
.WriteTo.File(path: @"C:\Users\abc\logs.log",
rollingInterval: RollingInterval.Day,
rollOnFileSizeLimit: true,
fileSizeLimitBytes: 10 * 1024 * 1024)
.CreateLogger();
Log.Information("testing");
There is no way to log blazor WASM in file directly. Because codes fully run in browser. You also can use other serilog sinks like browserconsole or blazor relay that provide special for blazor