serilog-sinks-browserconsole icon indicating copy to clipboard operation
serilog-sinks-browserconsole copied to clipboard

Portability on Blazor Server

Open sinsedrix opened this issue 8 months ago • 4 comments

Hi,

I'd like to have this sink work in a Blazor Server app. Is there a workaround to do it? Or would it need a completely different implementation?

Test project : https://github.com/sinsedrix/serilog-sinks-browserconsole / example/ExampleServer

sinsedrix avatar Mar 20 '25 13:03 sinsedrix

Hi! On the server, Serilog.Sinks.Console is the better option. Any reason to prefer this package?

nblumhardt avatar Mar 21 '25 01:03 nblumhardt

@nblumhardt The goal is to render server logs to browser console in a test environment. Test users won't be able to see console logs so I thought this sink would be suitable.

sinsedrix avatar Mar 24 '25 09:03 sinsedrix

Thanks for your reply, Cédric. This would require a completely different implementation, unfortunately (e.g. a sink that captured log events server-side, serialized them, and sent them to some client-side code for display in the browser terminal, perhaps via WebSockets - nontrivial :-))

Hope this helps, Nick

nblumhardt avatar Mar 25 '25 05:03 nblumhardt

Ok @nblumhardt , I implemented the log provider I needed in the test project I mentioned above. It behaves well but isn't a Serilog sink.

sinsedrix avatar Mar 25 '25 09:03 sinsedrix