I found documentation that you can't log directly in your Program.cs file but that it would be possible with a 3rd party library like Serilog. Microsoft Link
After finding out you can't break in your program.cs I tried to add logging to my program.cs. This doesn't seem to be working in Blazor WASM.
I tried it in a DotNet Core WebApi and it works just fine there.
The code I used in both the API as Blazor project:
Log.Logger = new LoggerConfiguration()
.WriteTo.File(@"hello\world\setup.txt")
.CreateLogger();
Log.Fatal("Hello friend!");
To be fair this seems like a bug. I'm looking for a working sample.
A Blazor WASM (Web Assembly) project runs in the user's browser, not on a server. This means "normal" things you're used to, like writing to a file, isn't possible.
You can log with Serilog or Microsoft's ILogger, but you need to send logs to an internet location. However, because WASM means that you transport your project's dll to the user's browser for them to execute, anyone can decompile your project and extract any sensitive connection details (urls, credentials, etc).
You may want to look into Telemetry rather than logging, such as with Application Insights (though it seems that is still in the works).